[mutter] frames: Freeze Xwayland commits until repainted



commit 53fce8e988e4e61acdd7ea51e16e20d11265c906
Author: Olivier Fourdan <ofourdan redhat com>
Date:   Wed Jan 15 10:40:54 2020 +0100

    frames: Freeze Xwayland commits until repainted
    
    To make sure the frame is painted before the commits are thawed, freeze
    the commits when invalidating the GDK window, only to thaw to it after
    the actual frame draw is performed or the frame is destroyed.
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/942

 src/ui/frames.c | 15 +++++++++++++++
 src/ui/frames.h |  2 ++
 2 files changed, 17 insertions(+)
---
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 6ee7da2ae..4bf8adca9 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -157,6 +157,11 @@ prefs_changed_callback (MetaPreference pref,
 static void
 invalidate_whole_window (MetaUIFrame *frame)
 {
+  if (!frame->is_frozen)
+    {
+      meta_window_x11_freeze_commits (frame->meta_window);
+      frame->is_frozen = TRUE;
+    }
   gdk_window_invalidate_rect (frame->window, NULL, FALSE);
 }
 
@@ -526,6 +531,7 @@ meta_frames_manage_window (MetaFrames *frames,
   frame->title = NULL;
   frame->prelit_control = META_FRAME_CONTROL_NONE;
   frame->button_state = META_BUTTON_STATE_NORMAL;
+  frame->is_frozen = FALSE;
 
   meta_x11_wm_grab_buttons (frames->x11_display, frame->xwindow);
 
@@ -555,6 +561,9 @@ meta_ui_frame_unmanage (MetaUIFrame *frame)
   if (frame->text_layout)
     g_object_unref (G_OBJECT (frame->text_layout));
 
+  if (frame->is_frozen)
+    meta_window_x11_thaw_commits (frame->meta_window);
+
   g_free (frame->title);
 
   g_free (frame);
@@ -1563,6 +1572,12 @@ meta_ui_frame_paint (MetaUIFrame  *frame,
                          &button_layout,
                          button_states,
                          mini_icon);
+
+  if (frame->is_frozen)
+    {
+      meta_window_x11_thaw_commits (frame->meta_window);
+      frame->is_frozen = FALSE;
+    }
 }
 
 static gboolean
diff --git a/src/ui/frames.h b/src/ui/frames.h
index b8f428f1f..c69f7c2f1 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -82,6 +82,8 @@ struct _MetaUIFrame
   MetaFrameControl prelit_control;
   MetaButtonState button_state;
   int grab_button;
+
+  gboolean is_frozen;
 };
 
 struct _MetaFrames


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]