From 0dc1e0ed2a46dc3d2e467ffb0c10c441782b0f57 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Mon, 10 Jun 2024 00:13:51 +0300 Subject: [PATCH] input-method: unmap popup surfaces on deactivate Fixes 743da5c0ae723098fe772aadb93810f60e700ab9 (cherry picked from commit f464213447a817307a3bda1e8e46d26cadfbffd6) --- types/wlr_input_method_v2.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/types/wlr_input_method_v2.c b/types/wlr_input_method_v2.c index 512adb310..83bf3b1d7 100644 --- a/types/wlr_input_method_v2.c +++ b/types/wlr_input_method_v2.c @@ -145,10 +145,13 @@ void wlr_input_popup_surface_v2_send_text_input_rectangle( popup_surface->resource, sbox->x, sbox->y, sbox->width, sbox->height); } -static void popup_surface_consider_map(struct wlr_input_popup_surface_v2 *popup_surface) { - if (wlr_surface_has_buffer(popup_surface->surface) && - popup_surface->input_method->client_active) { - wlr_surface_map(popup_surface->surface); +static void popup_surface_update_mapped(struct wlr_input_popup_surface_v2 *popup_surface) { + if (popup_surface->input_method->client_active) { + if (wlr_surface_has_buffer(popup_surface->surface)) { + wlr_surface_map(popup_surface->surface); + } + } else { + wlr_surface_unmap(popup_surface->surface); } } @@ -159,7 +162,7 @@ static void popup_surface_surface_role_commit(struct wlr_surface *surface) { return; } - popup_surface_consider_map(popup_surface); + popup_surface_update_mapped(popup_surface); } static void popup_surface_surface_role_destroy(struct wlr_surface *surface) { @@ -245,7 +248,7 @@ static void im_get_input_popup_surface(struct wl_client *client, wl_signal_init(&popup_surface->events.destroy); - popup_surface_consider_map(popup_surface); + popup_surface_update_mapped(popup_surface); wl_list_insert(&input_method->popup_surfaces, &popup_surface->link); wl_signal_emit_mutable(&input_method->events.new_popup_surface, popup_surface); @@ -489,7 +492,7 @@ void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method) { input_method->current_serial++; struct wlr_input_popup_surface_v2 *popup_surface; wl_list_for_each(popup_surface, &input_method->popup_surfaces, link) { - popup_surface_consider_map(popup_surface); + popup_surface_update_mapped(popup_surface); } }