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



commit d7a6f20f1134b7f9892f6eadaf40b3d73449a554
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 |   21 +++++++++++++++++++++
 src/wayland/meta-wayland-stage.h |    2 ++
 src/wayland/meta-wayland.c       |   18 +++++++++---------
 3 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/src/wayland/meta-wayland-stage.c b/src/wayland/meta-wayland-stage.c
index c303608..8a464ae 100644
--- a/src/wayland/meta-wayland-stage.c
+++ b/src/wayland/meta-wayland-stage.c
@@ -179,6 +179,8 @@ meta_wayland_stage_init (MetaWaylandStage *self)
     cogl_pipeline_copy (self->default_cursor_pipeline);
 
   meta_wayland_stage_set_default_cursor (self);
+
+  clutter_stage_set_user_resizable (CLUTTER_STAGE (self), FALSE);
 }
 
 ClutterActor *
@@ -241,3 +243,22 @@ meta_wayland_stage_set_default_cursor (MetaWaylandStage *self)
   self->cursor_height = self->default_cursor_height;
   update_cursor_position (self);
 }
+
+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 d25f270..23e0988 100644
--- a/src/wayland/meta-wayland-stage.h
+++ b/src/wayland/meta-wayland-stage.h
@@ -106,6 +106,8 @@ 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 fabfaa9..b61225e 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1945,6 +1945,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
@@ -2033,21 +2034,20 @@ meta_wayland_init (void)
        }
     }
 
-  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]