wayland: apply stage size according to the monitor config

Still 1024x768, because we don't have a way to configure that,
but at least now it's hardcoded in the right place.
This commit is contained in:
Giovanni Campagna 2013-07-18 15:06:36 +02:00
parent 2777dfc533
commit 0480d6c898
3 changed files with 31 additions and 9 deletions

View File

@ -55,6 +55,7 @@ meta_wayland_stage_class_init (MetaWaylandStageClass *klass)
static void
meta_wayland_stage_init (MetaWaylandStage *self)
{
clutter_stage_set_user_resizable (CLUTTER_STAGE (self), FALSE);
}
ClutterActor *
@ -64,3 +65,22 @@ meta_wayland_stage_new (void)
"cursor-visible", FALSE,
NULL);
}
void
meta_wayland_stage_apply_monitor_config (MetaWaylandStage *stage)
{
MetaMonitorManager *manager;
MetaMonitorInfo *infos;
int n_infos;
manager = meta_monitor_manager_get ();
infos = meta_monitor_manager_get_monitor_infos (manager, &n_infos);
g_assert (n_infos == 1);
/* 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 */
clutter_actor_set_size (CLUTTER_ACTOR (stage),
infos[0].rect.width, infos[0].rect.height);
}

View File

@ -65,6 +65,8 @@ 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

@ -1424,6 +1424,7 @@ on_monitors_changed (MetaMonitorManager *monitors,
{
g_list_free_full (compositor->outputs, (GDestroyNotify) wl_global_destroy);
meta_wayland_compositor_create_outputs (compositor, monitors);
meta_wayland_stage_apply_monitor_config (META_WAYLAND_STAGE (compositor->stage));
}
void
@ -1532,21 +1533,20 @@ meta_wayland_init (void)
dup2 (fd, STDIN_FILENO);
}
compositor->stage = meta_wayland_stage_new ();
/* FIXME */
clutter_actor_set_size (CLUTTER_ACTOR (compositor->stage), 1024, 768);
clutter_stage_set_user_resizable (CLUTTER_STAGE (compositor->stage), FALSE);
g_signal_connect_after (compositor->stage, "paint",
G_CALLBACK (paint_finished_cb), compositor);
g_signal_connect (compositor->stage, "destroy",
G_CALLBACK (stage_destroy_cb), NULL);
meta_monitor_manager_initialize (NULL);
monitors = meta_monitor_manager_get ();
g_signal_connect (monitors, "monitors-changed",
G_CALLBACK (on_monitors_changed), compositor);
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);
g_signal_connect (compositor->stage, "destroy",
G_CALLBACK (stage_destroy_cb), NULL);
meta_wayland_data_device_manager_init (compositor->wayland_display);
compositor->seat = meta_wayland_seat_new (compositor->wayland_display,