input-method: unmap popup surfaces on deactivate

Fixes 743da5c0ae
This commit is contained in:
Kirill Primak 2024-06-10 00:13:51 +03:00 committed by Simon Zeni
parent 1e58e4006d
commit f464213447

View File

@ -147,11 +147,14 @@ void wlr_input_popup_surface_v2_send_text_input_rectangle(
popup_surface->resource, sbox->x, sbox->y, sbox->width, sbox->height); 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) { static void popup_surface_update_mapped(struct wlr_input_popup_surface_v2 *popup_surface) {
if (wlr_surface_has_buffer(popup_surface->surface) && if (popup_surface->input_method->client_active) {
popup_surface->input_method->client_active) { if (wlr_surface_has_buffer(popup_surface->surface)) {
wlr_surface_map(popup_surface->surface); wlr_surface_map(popup_surface->surface);
} }
} else {
wlr_surface_unmap(popup_surface->surface);
}
} }
static void popup_surface_surface_role_commit(struct wlr_surface *surface) { static void popup_surface_surface_role_commit(struct wlr_surface *surface) {
@ -161,7 +164,7 @@ static void popup_surface_surface_role_commit(struct wlr_surface *surface) {
return; return;
} }
popup_surface_consider_map(popup_surface); popup_surface_update_mapped(popup_surface);
} }
static void popup_surface_surface_role_destroy(struct wlr_surface *surface) { static void popup_surface_surface_role_destroy(struct wlr_surface *surface) {
@ -247,7 +250,7 @@ static void im_get_input_popup_surface(struct wl_client *client,
wl_signal_init(&popup_surface->events.destroy); 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_list_insert(&input_method->popup_surfaces, &popup_surface->link);
wl_signal_emit_mutable(&input_method->events.new_popup_surface, popup_surface); wl_signal_emit_mutable(&input_method->events.new_popup_surface, popup_surface);
@ -491,7 +494,7 @@ void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method) {
input_method->current_serial++; input_method->current_serial++;
struct wlr_input_popup_surface_v2 *popup_surface; struct wlr_input_popup_surface_v2 *popup_surface;
wl_list_for_each(popup_surface, &input_method->popup_surfaces, link) { wl_list_for_each(popup_surface, &input_method->popup_surfaces, link) {
popup_surface_consider_map(popup_surface); popup_surface_update_mapped(popup_surface);
} }
} }