From 49a83138f41474a36a7f41c162c3622d3dc2e46b Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Tue, 23 Jul 2013 10:36:51 +0200 Subject: [PATCH] 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 e2e9e24bf..7f9a04717 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -624,7 +624,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; @@ -666,6 +666,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 */ @@ -767,6 +770,8 @@ meta_compositor_manage_screen (MetaCompositor *compositor, redirect_windows (compositor, screen); } + + clutter_actor_show (info->stage); } void @@ -1415,18 +1420,25 @@ meta_compositor_sync_screen_size (MetaCompositor *compositor, guint width, guint height) { + MetaCompScreen *info = meta_screen_get_compositor_data (screen); + if (meta_is_wayland_compositor ()) { - /* 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; @@ -1437,11 +1449,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 7e2de747f..641b6bdad 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -2877,10 +2877,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 d3f2634b2..462aadb25 100644 --- a/src/wayland/meta-wayland-stage.c +++ b/src/wayland/meta-wayland-stage.c @@ -66,23 +66,3 @@ meta_wayland_stage_new (void) NULL); } -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 fae7cc7a0..c242fbd60 100644 --- a/src/wayland/meta-wayland-stage.h +++ b/src/wayland/meta-wayland-stage.h @@ -65,8 +65,6 @@ GType meta_wayland_stage_get_type (void) G_GNUC_CONST ClutterActor *meta_wayland_stage_new (void); -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 857509281..e6b33358a 100644 --- a/src/wayland/meta-wayland.c +++ b/src/wayland/meta-wayland.c @@ -1441,7 +1441,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 @@ -1557,7 +1556,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); @@ -1589,8 +1587,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");