text_input: Ignore text_input disable from unfocused windows

Before this commit, there would be cases where focus changes from one
window to another, the new window activates text_input, then the old
window sends a deactivate request, making text_input unfocused
completely.
This commit is contained in:
Tadeo Kondrak 2021-01-26 13:48:42 -07:00 committed by Tudor Brindus
parent 31a01bb80d
commit b0e8f4ade2

View file

@ -144,6 +144,10 @@ static void handle_text_input_disable(struct wl_listener *listener,
void *data) { void *data) {
struct sway_text_input *text_input = wl_container_of(listener, text_input, struct sway_text_input *text_input = wl_container_of(listener, text_input,
text_input_disable); text_input_disable);
if (text_input->input->focused_surface == NULL) {
sway_log(SWAY_DEBUG, "Disabling text input, but no longer focused");
return;
}
relay_disable_text_input(text_input->relay, text_input); relay_disable_text_input(text_input->relay, text_input);
} }