[mutter] display: Only manage the default X screen



commit 1a521e10c3ee3dea34e82bc708aaf5a2b75eca14
Author: JÃrg Billeter <j bitron ch>
Date:   Mon Sep 10 20:19:21 2012 +0200

    display: Only manage the default X screen
    
    https://bugzilla.gnome.org/show_bug.cgi?id=648156

 src/core/display.c |   20 ++++++++++----------
 src/ui/ui.c        |    6 ++++++
 src/ui/ui.h        |    2 ++
 3 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/src/core/display.c b/src/core/display.c
index 19c3437..bf4796d 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -470,6 +470,7 @@ meta_display_open (void)
 {
   Display *xdisplay;
   GSList *screens;
+  MetaScreen *screen;
   GSList *tmp;
   int i;
   guint32 timestamp;
@@ -854,19 +855,18 @@ meta_display_open (void)
   the_display->last_user_time = timestamp;
   the_display->compositor = NULL;
   
+  /* Mutter used to manage all X screens of the display in a single process, but
+   * now it always manages exactly one screen as specified by the DISPLAY
+   * environment variable. The screens GSList is left for simplicity.
+   */
   screens = NULL;
-  
-  i = 0;
-  while (i < ScreenCount (xdisplay))
-    {
-      MetaScreen *screen;
 
-      screen = meta_screen_new (the_display, i, timestamp);
+  i = meta_ui_get_screen_number ();
 
-      if (screen)
-        screens = g_slist_prepend (screens, screen);
-      ++i;
-    }
+  screen = meta_screen_new (the_display, i, timestamp);
+
+  if (screen)
+    screens = g_slist_prepend (screens, screen);
   
   the_display->screens = screens;
   
diff --git a/src/ui/ui.c b/src/ui/ui.c
index b0ca41d..e21c69c 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -82,6 +82,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
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 3675b3a..4a510b5 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -46,6 +46,8 @@ void meta_ui_init (void);
 
 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);



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