From f1fe6ec776f77115cadf308530da50994aab3018 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 1 Jun 2022 16:56:11 +0100 Subject: [PATCH] xdg-shell: Mark xdg_popup surfaces as mapped Keep the surface map state in sync with the buffer state: the surface can be mapped it has a valid buffer, and not if it doesn't. Signed-off-by: Daniel Stone --- libweston-desktop/xdg-shell-v6.c | 8 ++++++++ libweston-desktop/xdg-shell.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/libweston-desktop/xdg-shell-v6.c b/libweston-desktop/xdg-shell-v6.c index ff3a6344..13f4213d 100644 --- a/libweston-desktop/xdg-shell-v6.c +++ b/libweston-desktop/xdg-shell-v6.c @@ -841,6 +841,14 @@ weston_desktop_xdg_popup_committed(struct weston_desktop_xdg_popup *popup) popup->committed = true; weston_desktop_xdg_popup_update_position(popup->base.desktop_surface, popup); + + if (!weston_surface_is_mapped(wsurface) && + weston_surface_has_content(wsurface)) { + weston_surface_map(wsurface); + } else if (weston_surface_is_mapped(wsurface) && + !weston_surface_has_content(wsurface)) { + weston_surface_unmap(wsurface); + } } static void diff --git a/libweston-desktop/xdg-shell.c b/libweston-desktop/xdg-shell.c index 4b0509b1..eea00143 100644 --- a/libweston-desktop/xdg-shell.c +++ b/libweston-desktop/xdg-shell.c @@ -962,6 +962,14 @@ weston_desktop_xdg_popup_committed(struct weston_desktop_xdg_popup *popup) popup->committed = true; weston_desktop_xdg_popup_update_position(popup->base.desktop_surface, popup); + + if (!weston_surface_is_mapped(wsurface) && + weston_surface_has_content(wsurface)) { + weston_surface_map(wsurface); + } else if (weston_surface_is_mapped(wsurface) && + !weston_surface_has_content(wsurface)) { + weston_surface_unmap(wsurface); + } } static void