[mutter/wip/wayland-display] Remove duplicate path for resizing clutter stage



commit d04bbc89530f70fc4654298ba98c823af02d9c14
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Jul 23 10:36:51 2013 +0200

    Remove duplicate path for resizing clutter stage
    
    Handle it in meta_compositor_sync_stage_size(), like we do under
    X11.

 src/compositor/compositor.c      |   34 +++++++++++++++++++++++-----------
 src/core/screen.c                |    7 +++----
 src/wayland/meta-wayland-stage.c |   20 --------------------
 src/wayland/meta-wayland-stage.h |    2 --
 src/wayland/meta-wayland.c       |    4 ----
 5 files changed, 26 insertions(+), 41 deletions(-)
---
diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c
index d9a7aa9..7aaa2f0 100644
--- a/src/compositor/compositor.c
+++ b/src/compositor/compositor.c
@@ -618,7 +618,7 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
   MetaCompScreen *info;
   MetaDisplay    *display       = meta_screen_get_display (screen);
   Display        *xdisplay      = meta_display_get_xdisplay (display);
-  Window          xwin;
+  Window          xwin          = None;
   gint            width, height;
 #ifdef HAVE_WAYLAND
   MetaWaylandCompositor *wayland_compositor;
@@ -660,6 +660,9 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
     {
       wayland_compositor = meta_wayland_compositor_get_default ();
       info->stage = wayland_compositor->stage;
+
+      meta_screen_get_size (screen, &width, &height);
+      clutter_actor_set_size (info->stage, width, height);
     }
   else
 #endif /* HAVE_WAYLAND */
@@ -761,6 +764,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor,
 
       redirect_windows (compositor, screen);
     }
+
+  clutter_actor_show (info->stage);
 }
 
 void
@@ -1409,18 +1414,25 @@ meta_compositor_sync_screen_size (MetaCompositor  *compositor,
                                  guint            width,
                                  guint            height)
 {
+  MetaCompScreen *info    = meta_screen_get_compositor_data (screen);
+
   if (meta_is_display_server ())
     {
-      /* It's not clear at the moment how we will be dealing with screen
-       * resizing as a Wayland compositor so for now just abort if we
-       * hit this code. */
-      g_critical ("Unexpected call to meta_compositor_sync_screen_size() "
-                  "when running as a wayland compositor");
+      /* FIXME: when we support a sliced stage, this is the place to do it
+         But! This is not the place to apply KMS config, here we only
+         notify Clutter/Cogl/GL that the framebuffer sizes changed.
+
+         And because for now clutter does not do sliced, we use one
+         framebuffer the size of the whole screen, and when running on
+         bare metal MetaMonitorManager will do the necessary tricks to
+         show the right portions on the right screens.
+      */
+
+      clutter_actor_set_size (info->stage, width, height);
     }
   else
     {
       MetaDisplay    *display = meta_screen_get_display (screen);
-      MetaCompScreen *info    = meta_screen_get_compositor_data (screen);
       Display        *xdisplay;
       Window          xwin;
 
@@ -1431,11 +1443,11 @@ meta_compositor_sync_screen_size (MetaCompositor  *compositor,
       xwin = clutter_x11_get_stage_window (CLUTTER_STAGE (info->stage));
 
       XResizeWindow (xdisplay, xwin, width, height);
-
-      meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
-                    meta_screen_get_screen_number (screen),
-                    width, height);
     }
+
+  meta_verbose ("Changed size for stage on screen %d to %dx%d\n",
+                meta_screen_get_screen_number (screen),
+                width, height);
 }
 
 static void
diff --git a/src/core/screen.c b/src/core/screen.c
index f5b119e..a8a4ee0 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -2886,10 +2886,9 @@ on_monitors_changed (MetaMonitorManager *manager,
                        &changes);
     }
 
-  if (screen->display->compositor)
-    meta_compositor_sync_screen_size (screen->display->compositor,
-                                     screen,
-                                      screen->rect.width, screen->rect.height);
+  meta_compositor_sync_screen_size (screen->display->compositor,
+                                    screen,
+                                    screen->rect.width, screen->rect.height);
 
   /* Queue a resize on all the windows */
   meta_screen_foreach_window (screen, meta_screen_resize_func, 0);
diff --git a/src/wayland/meta-wayland-stage.c b/src/wayland/meta-wayland-stage.c
index 20cb386..8b12ecc 100644
--- a/src/wayland/meta-wayland-stage.c
+++ b/src/wayland/meta-wayland-stage.c
@@ -244,23 +244,3 @@ meta_wayland_stage_set_default_cursor (MetaWaylandStage *self)
   update_cursor_position (self);
 }
 
-void
-meta_wayland_stage_apply_monitor_config (MetaWaylandStage *stage)
-{
-  MetaMonitorManager *manager;
-  int width, height;
-
-  manager = meta_monitor_manager_get ();
-  meta_monitor_manager_get_screen_size (manager, &width, &height);
-
-  /* FIXME: when we support a sliced stage, this is the place to do it
-     But! This is not the place to apply KMS config, here we only
-     notify Clutter/Cogl/GL that the framebuffer sizes changed.
-
-     And because for now clutter does not do sliced, we use one
-     framebuffer the size of the whole screen, and when running on
-     bare metal MetaMonitorManager will do the necessary tricks to
-     show the right portions on the right screens.
-  */
-  clutter_actor_set_size (CLUTTER_ACTOR (stage), width, height);
-}
diff --git a/src/wayland/meta-wayland-stage.h b/src/wayland/meta-wayland-stage.h
index 23e0988..d25f270 100644
--- a/src/wayland/meta-wayland-stage.h
+++ b/src/wayland/meta-wayland-stage.h
@@ -106,8 +106,6 @@ void              meta_wayland_stage_set_cursor_from_texture (MetaWaylandStage *
 
 void              meta_wayland_stage_set_invisible_cursor    (MetaWaylandStage *self);
 
-void              meta_wayland_stage_apply_monitor_config    (MetaWaylandStage *self);
-
 G_END_DECLS
 
 #endif /* META_WAYLAND_STAGE_H */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index e1d1d5d..c3c2560 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1941,7 +1941,6 @@ on_monitors_changed (MetaMonitorManager    *monitors,
   g_list_free_full (compositor->outputs, (GDestroyNotify) wl_global_destroy);
   compositor->outputs = NULL;
   meta_wayland_compositor_create_outputs (compositor, monitors);
-  meta_wayland_stage_apply_monitor_config (META_WAYLAND_STAGE (compositor->stage));
 }
 
 void
@@ -2037,7 +2036,6 @@ meta_wayland_init (void)
   meta_wayland_compositor_create_outputs (compositor, monitors);
 
   compositor->stage = meta_wayland_stage_new ();
-  meta_wayland_stage_apply_monitor_config (META_WAYLAND_STAGE (compositor->stage));
 
   g_signal_connect_after (compositor->stage, "paint",
                           G_CALLBACK (paint_finished_cb), compositor);
@@ -2068,8 +2066,6 @@ meta_wayland_init (void)
                        compositor, bind_shell) == NULL)
     g_error ("Failed to register a global shell object");
 
-  clutter_actor_show (compositor->stage);
-
   if (wl_display_add_socket (compositor->wayland_display, "wayland-0"))
     g_error ("Failed to create socket");
 


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