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.
This commit is contained in:
Jasper St. Pierre 2011-12-15 16:03:00 -05:00
parent 264c555af0
commit ac7ec585c8

View File

@ -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)
{
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);