diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2023-03-31 16:01:20 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2023-04-27 11:26:02 +0200 |
commit | f8d6ae3877aacaeea2876f2dad054278895708b8 (patch) | |
tree | 7f80b28fde69124590eadfdfbe667abbe1c4c924 | |
parent | 3bf134075e6ffe172a2604e013423c4ceff923e8 (diff) |
xwayland/window: Queue damage after commits are allowedxwayland-22.1
Compositors may use XWAYLAND_ALLOW_COMMITS to communicate when Xwayland
may or may not commit new buffers to a wl_surface. If commits are
denied, then later allowed, we'll only get a buffer attached if there is
actual damage posted, which might be long after.
This fixes an issue where the window manager would reparent a window
while denying commits, then after reparenting, allow commits. The window
in question belonged to a game and took several seconds produce the next
frame, resulting in an empty window appearing as if it had just
disappeared.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
(cherry picked from commit 9a55c402aa803fb10e39ab4fd18a709d0cd06fd4)
-rw-r--r-- | hw/xwayland/xwayland-window.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c index 462d27a57..1b904166d 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -102,9 +102,21 @@ static void xwl_window_set_allow_commits(struct xwl_window *xwl_window, Bool allow, const char *debug_msg) { + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + DamagePtr damage; + xwl_window->allow_commits = allow; DebugF("XWAYLAND: win %d allow_commits = %d (%s)\n", xwl_window->window->drawable.id, allow, debug_msg); + + damage = window_get_damage(xwl_window->window); + if (allow && + xorg_list_is_empty(&xwl_window->link_damage) && + damage && + RegionNotEmpty(DamageRegion(damage))) { + xorg_list_add(&xwl_window->link_damage, + &xwl_screen->damage_window_list); + } } static void |