[mutter/wip/wayland-display: 28/65] wayland: apply stage size according to the monitor config



commit 0480d6c89825cc6a7e1583b0bdd1200880dfe01b
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Thu Jul 18 15:06:36 2013 +0200

    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.

 src/wayland/meta-wayland-stage.c |   20 ++++++++++++++++++++
 src/wayland/meta-wayland-stage.h |    2 ++
 src/wayland/meta-wayland.c       |   18 +++++++++---------
 3 files changed, 31 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-stage.c b/src/wayland/meta-wayland-stage.c
index f7d28d4..66f7f29 100644
--- a/src/wayland/meta-wayland-stage.c
+++ b/src/wayland/meta-wayland-stage.c
@@ -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);
+}
diff --git a/src/wayland/meta-wayland-stage.h b/src/wayland/meta-wayland-stage.h
index c242fbd..fae7cc7 100644
--- a/src/wayland/meta-wayland-stage.h
+++ b/src/wayland/meta-wayland-stage.h
@@ -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 */
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 99fd4b3..c13224e 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -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,


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