From 4ae9953607c82166e2bc7f342d2663d38314f6bd Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 2 Dec 2019 14:01:30 +0100 Subject: [PATCH] window/x11: Freeze commits on resize Make sure we freeze commits before resizing the window as this will clear the frame to black. Set the "thaw on paint" flag so that the post paint for window actor X11 can then thaw the freeze initiated prior to the resize and keep the freeze/thaw balanced. https://gitlab.gnome.org/GNOME/mutter/merge_requests/942 --- src/compositor/meta-window-actor-x11.c | 10 ++++++++++ src/x11/window-x11.c | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index b7032e0ba..2c0bd9939 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -40,6 +40,7 @@ #include "meta/meta-x11-errors.h" #include "meta/window.h" #include "x11/meta-x11-display-private.h" +#include "x11/window-x11.h" enum { @@ -1213,6 +1214,7 @@ static void meta_window_actor_x11_post_paint (MetaWindowActor *actor) { MetaWindowActorX11 *actor_x11 = META_WINDOW_ACTOR_X11 (actor); + MetaWindow *window; actor_x11->repaint_scheduled = FALSE; @@ -1238,6 +1240,14 @@ meta_window_actor_x11_post_paint (MetaWindowActor *actor) actor_x11->needs_frame_drawn = FALSE; } + + /* This is for Xwayland, and a no-op on plain Xorg */ + window = meta_window_actor_get_meta_window (actor); + if (meta_window_x11_should_thaw_after_paint (window)) + { + meta_window_x11_thaw_commits (window); + meta_window_x11_set_thaw_after_paint (window, FALSE); + } } static gboolean diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index fdd86efa6..93cfa8e0d 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -1448,6 +1448,16 @@ meta_window_x11_move_resize_internal (MetaWindow *window, (window->size_hints.flags & USPosition))) need_configure_notify = TRUE; + /* If resizing, freeze commits - This is for Xwayland, and a no-op on Xorg */ + if (need_resize_client || need_resize_frame) + { + if (!meta_window_x11_should_thaw_after_paint (window)) + { + meta_window_x11_set_thaw_after_paint (window, TRUE); + meta_window_x11_freeze_commits (window); + } + } + /* The rest of this function syncs our new size/pos with X as * efficiently as possible */