[gtk+] [GdkScreenX11] Add heuristic for pre XRandR 1.3 drivers



commit 5651cbc4b4478032238fc376f89e480c71cfa87b
Author: Adel Gadllah <adel gadllah gmail com>
Date:   Tue Apr 6 02:36:53 2010 +0200

    [GdkScreenX11] Add heuristic for pre XRandR 1.3 drivers
    
    Currently gdk_screen_get_primary_monitor just returns the first monitor,
    in this case but both the panel and now gnome-shell use an additional
    heuristic to prefer LVDS as primary if present.
    
    Move this heuristic to gdk_screen_get_primary_monitor to avoid duplicating
    it all over the place.
    
    The fallback heuristic is also used when no primary output is set.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614894

 gdk/x11/gdkscreen-x11.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c
index 8c494aa..76ab17f 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -771,7 +771,7 @@ init_randr13 (GdkScreen *screen)
       XRROutputInfo *output =
 	XRRGetOutputInfo (dpy, resources, resources->outputs[i]);
 
-      if (resources->outputs[i] == primary_output)
+      if (primary_output != None && resources->outputs[i] == primary_output)
         {
           screen_x11->primary_monitor = i;
         }
@@ -785,6 +785,12 @@ init_randr13 (GdkScreen *screen)
           continue;
         }
 
+      /* No RandR1.3+ available or no primary set, fall back to prefer LVDS as primary if present */
+      if (g_ascii_strncasecmp (output->name, "LVDS", 4) == 0)
+        {
+          screen_x11->primary_monitor = i;
+        }
+
       if (output->crtc)
 	{
 	  GdkX11Monitor monitor;



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