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>
This commit is contained in:
Jonas Ådahl 2023-03-31 16:01:20 +02:00 committed by Michel Dänzer
parent 5ce96a2a73
commit 9a55c402aa

View File

@ -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