Remove duplicate path for resizing clutter stage

Handle it in meta_compositor_sync_stage_size(), like we do under
X11.
This commit is contained in:
Giovanni Campagna 2013-07-23 10:36:51 +02:00
parent 1e3aad2d8c
commit 49a83138f4
5 changed files with 26 additions and 41 deletions

View File

@ -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

View File

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

View File

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

View File

@ -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 */

View File

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