[metacity] display: reframe windows when compositing changes



commit 56bc89dc923e368b0ff5be8ab28be06df5060ed1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Aug 22 18:43:18 2019 +0300

    display: reframe windows when compositing changes

 src/core/display.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index ce3b6904..4e150d29 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -235,16 +235,42 @@ sn_error_trap_pop (SnDisplay *sn_display,
 }
 #endif
 
+static void
+reframe_func (MetaScreen *screen,
+              MetaWindow *window,
+              gpointer    user_data)
+{
+  meta_window_reframe (window);
+}
+
+static void
+notify_composited_cb (MetaCompositor *compositor,
+                      GParamSpec     *pspec,
+                      MetaDisplay    *display)
+{
+  gboolean composited;
+
+  meta_screen_foreach_window (display->screen, reframe_func, NULL);
+
+  composited = meta_compositor_is_composited (display->compositor);
+  meta_ui_set_composited (display->screen->ui, composited);
+}
+
 static void
 update_compositor (MetaDisplay *display,
                    gboolean     composite_windows)
 {
   const gchar *compositor;
   MetaCompositorType type;
+  gboolean old_composited;
   gboolean composited;
 
+  old_composited = FALSE;
   if (display->compositor != NULL)
-    g_object_unref (display->compositor);
+    {
+      old_composited = meta_compositor_is_composited (display->compositor);
+      g_object_unref (display->compositor);
+    }
 
   compositor = g_getenv ("META_COMPOSITOR");
   if (compositor != NULL)
@@ -265,11 +291,17 @@ update_compositor (MetaDisplay *display,
     }
 
   display->compositor = meta_compositor_new (type, display);
+  composited = meta_compositor_is_composited (display->compositor);
+
+  g_signal_connect (display->compositor, "notify::composited",
+                    G_CALLBACK (notify_composited_cb), display);
+
+  if (old_composited != composited)
+    meta_screen_foreach_window (display->screen, reframe_func, NULL);
 
   if (composite_windows)
     meta_screen_composite_all_windows (display->screen);
 
-  composited = meta_compositor_is_composited (display->compositor);
   meta_ui_set_composited (display->screen->ui, composited);
 }
 


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