[mutter] compositor: Use raw Xlib to resize the compositor window



commit ac7ec585c882d39a98d68189ffde83e1a7ffe2e7
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Dec 15 16:03:00 2011 -0500

    compositor: Use raw Xlib to resize the compositor window
    
    If we get two configure events on the root window in close
    sequence, then we could get the sequence:
    
     ConfigureNotify on the root window w1xh1
       Processed by Mutter
     clutter_actor_set_size(stage, w1, h1)
     <relayout happens, stage window resized by clutter>
    
     ConfigureNotify on the root window, w2xh2
       Processed by Mutter
     clutter_actor_set_size(stage, w2, h2)
     ConfigureNotify on the stage window, w1, h1)
       Processed by Clutter
     clutter_actor_set_size(stage, w1, h1)
     <relayout happens, stage window resized by clutter>
    
    Leaving the stage at the wrong size. To avoid fighting with Clutter,
    switch to resizing the stage with XResizeWindow(), similar to how a
    toplevel window is handled by a window manager.

 src/compositor/compositor.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index 468667f..76bf8f5 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -518,11 +518,12 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
   info->stage = clutter_stage_new ();
 
   meta_screen_get_size (screen, &width, &height);
-  clutter_actor_set_size (info->stage, width, height);
   clutter_actor_realize (info->stage);
 
   xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
 
+  XResizeWindow (xdisplay, xwin, width, height);
+
   event_mask = FocusChangeMask |
                ExposureMask |
                EnterWindowMask | LeaveWindowMask |
@@ -1140,12 +1141,18 @@ meta_compositor_sync_screen_size (MetaCompositor  *compositor,
 				  guint		   width,
 				  guint		   height)
 {
-  MetaCompScreen *info = meta_screen_get_compositor_data (screen);
+  MetaDisplay    *display = meta_screen_get_display (screen);
+  MetaCompScreen *info    = meta_screen_get_compositor_data (screen);
+  Display        *xdisplay;
+  Window          xwin;
 
   DEBUG_TRACE ("meta_compositor_sync_screen_size\n");
   g_return_if_fail (info);
 
-  clutter_actor_set_size (info->stage, width, height);
+  xdisplay = meta_display_get_xdisplay (display);
+  xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
+
+  XResizeWindow (xdisplay, xwin, width, height);
 
   meta_background_actor_screen_size_changed (screen);
 



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