diff options
author | Tadeo Kondrak <me@tadeo.ca> | 2021-12-30 22:49:48 -0700 |
---|---|---|
committer | Tadeo Kondrak <me@tadeo.ca> | 2022-01-16 09:08:39 -0700 |
commit | 5091118bed82394de5a151d658e895bb44059b61 (patch) | |
tree | 869a85fe77b167599e57aed782dde895ee962654 | |
parent | 89dc9a44968fbd3fe8a08a41858d1537ee145668 (diff) |
input_method_v2: improve mapping detection
Detect NULL commits before the surface is actually committed, allowing
the surface to be properly damaged on unmap.
-rw-r--r-- | types/wlr_input_method_v2.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/types/wlr_input_method_v2.c b/types/wlr_input_method_v2.c index c9390e97..559927eb 100644 --- a/types/wlr_input_method_v2.c +++ b/types/wlr_input_method_v2.c @@ -157,9 +157,22 @@ static void popup_surface_surface_role_commit(struct wlr_surface *surface) { && popup_surface->input_method->client_active); } +static void popup_surface_surface_role_precommit(struct wlr_surface *surface, + const struct wlr_surface_state *state) { + struct wlr_input_popup_surface_v2 *popup_surface = surface->role_data; + if (popup_surface == NULL) { + return; + } + if (state->committed & WLR_SURFACE_STATE_BUFFER && state->buffer == NULL) { + // This is a NULL commit + popup_surface_set_mapped(popup_surface, false); + } +} + static const struct wlr_surface_role input_popup_surface_v2_role = { .name = "zwp_input_popup_surface_v2", .commit = popup_surface_surface_role_commit, + .precommit = popup_surface_surface_role_precommit, }; bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface) { |