diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2023-03-31 16:01:20 +0200 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2023-04-26 07:46:45 +0000 |
commit | 9a55c402aa803fb10e39ab4fd18a709d0cd06fd4 (patch) | |
tree | 1a70c76f321a2e43ce354587b733e8daf7734e74 | |
parent | 5ce96a2a733b0a6556e1512fd9a703ede6a7c959 (diff) | |
download | xserver-9a55c402aa803fb10e39ab4fd18a709d0cd06fd4.tar.gz |
xwayland/window: Queue damage after commits are allowed
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>
-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 b7574eeb5..67485d1d3 100644 --- a/hw/xwayland/xwayland-window.c +++ b/hw/xwayland/xwayland-window.c @@ -106,9 +106,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 |