aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2025-06-13 18:02:55 +0000
committerFurkan Sahin <furkan-dev@proton.me>2025-06-13 18:02:55 +0000
commit4b12d44a0d03be8d4116dcd78eaf9d07fd22073a (patch)
treea54d9de27c0f9a3c13c55dfeb051ea1037d8ee32
parenta07e6c0392735f8f7ea8bca675ea01293c4d6970 (diff)
text_input: Ignore enable requests from unfocused windows
Unfocused windows shouldn't be allowed to activate the IM. This fixes an issue with swaymsg invocations that contain several commands which result in multiple swift focus changes. An application briefly gets text input focus, sends an enable request, then sway processes it and activates the IM only after the commands are all finished and focus is on something else which did not send an enable request.
-rw-r--r--sway/input/text_input.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/input/text_input.c b/sway/input/text_input.c
index 0eb76eb1..2729db62 100644
--- a/sway/input/text_input.c
+++ b/sway/input/text_input.c
@@ -248,6 +248,10 @@ static void relay_send_im_state(struct sway_input_method_relay *relay,
static void handle_text_input_enable(struct wl_listener *listener, void *data) {
struct sway_text_input *text_input = wl_container_of(listener, text_input,
text_input_enable);
+ if (text_input->input->focused_surface == NULL) {
+ sway_log(SWAY_DEBUG, "Enabling text input, but no longer focused");
+ return;
+ }
if (text_input->relay->input_method == NULL) {
sway_log(SWAY_INFO, "Enabling text input when input method is gone");
return;