[metacity] display: manage only default screen



commit aae87c0ddb445a8706d48926a6a90a2d290653bb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Jun 12 00:43:51 2016 +0300

    display: manage only default screen

 src/core/display.c |   17 ++++++-----------
 src/include/ui.h   |    2 ++
 src/ui/ui.c        |    6 ++++++
 3 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 8d02d41..8612d3a 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -304,6 +304,7 @@ meta_display_open (void)
   GSList *tmp;
   int i;
   guint32 timestamp;
+  MetaScreen *screen;
 
   /* A list of all atom names, so that we can intern them in one go. */
   const gchar *atom_names[] = {
@@ -665,17 +666,11 @@ meta_display_open (void)
 
   screens = NULL;
 
-  i = 0;
-  while (i < ScreenCount (xdisplay))
-    {
-      MetaScreen *screen;
-
-      screen = meta_screen_new (the_display, i, timestamp);
+  i = meta_ui_get_screen_number ();
+  screen = meta_screen_new (the_display, i, timestamp);
 
-      if (screen)
-        screens = g_slist_prepend (screens, screen);
-      ++i;
-    }
+  if (screen)
+    screens = g_slist_prepend (screens, screen);
 
   the_display->screens = screens;
 
@@ -700,7 +695,7 @@ meta_display_open (void)
   tmp = the_display->screens;
   while (tmp != NULL)
     {
-      MetaScreen *screen = tmp->data;
+      screen = tmp->data;
 
       meta_screen_manage_all_windows (screen);
 
diff --git a/src/include/ui.h b/src/include/ui.h
index 353d1a0..7be0c9f 100644
--- a/src/include/ui.h
+++ b/src/include/ui.h
@@ -49,6 +49,8 @@ void meta_ui_init (int *argc, char ***argv);
 
 Display* meta_ui_get_display (void);
 
+gint     meta_ui_get_screen_number (void);
+
 void meta_ui_add_event_func    (Display       *xdisplay,
                                 MetaEventFunc  func,
                                 gpointer       data);
diff --git a/src/ui/ui.c b/src/ui/ui.c
index a9676c7..1834a1f 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -88,6 +88,12 @@ meta_ui_get_display (void)
   return GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
 }
 
+gint
+meta_ui_get_screen_number (void)
+{
+  return gdk_screen_get_number (gdk_screen_get_default ());
+}
+
 /* We do some of our event handling in frames.c, which expects
  * GDK events delivered by GTK+.  However, since the transition to
  * client side windows, we can't let GDK see button events, since the


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