[gnome-flashback] display-config: fix crash with XRandR 1.2



commit 14bd500e560d7aef62dfeeac0e87574d702c6d86
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jan 18 17:42:36 2016 +0200

    display-config: fix crash with XRandR 1.2
    
    Attempt to fix crash reported here:
    https://mail.gnome.org/archives/gnome-flashback-list/2015-December/msg00021.html

 .../libdisplay-config/flashback-monitor-manager.c  |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gnome-flashback/libdisplay-config/flashback-monitor-manager.c 
b/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
index 8812dbd..561020c 100644
--- a/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
+++ b/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
@@ -56,6 +56,7 @@ struct _FlashbackMonitorManagerPrivate
   int                    rr_event_base;
   int                    rr_error_base;
 
+  gboolean               has_randr13;
   gboolean               has_randr15;
 
   MetaDBusDisplayConfig *display_config;
@@ -1285,7 +1286,11 @@ read_current_config (FlashbackMonitorManager *manager)
   manager->screen_width = WidthOfScreen (screen);
   manager->screen_height = HeightOfScreen (screen);
 
-  resources = XRRGetScreenResourcesCurrent (priv->xdisplay, DefaultRootWindow (priv->xdisplay));
+  if (priv->has_randr13)
+    resources = XRRGetScreenResourcesCurrent (priv->xdisplay, DefaultRootWindow (priv->xdisplay));
+  else
+    resources = XRRGetScreenResources (priv->xdisplay, DefaultRootWindow (priv->xdisplay));
+
   if (!resources)
     return;
 
@@ -1579,10 +1584,14 @@ flashback_monitor_manager_init (FlashbackMonitorManager *manager)
                   RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask |
                   RROutputPropertyNotifyMask);
 
+  priv->has_randr13 = FALSE;
   priv->has_randr15 = FALSE;
 
   XRRQueryVersion (priv->xdisplay, &major_version, &minor_version);
 
+  if (major_version > 1 || (major_version == 1 && minor_version >= 3))
+    priv->has_randr13 = TRUE;
+
 #ifdef HAVE_XRANDR15
   if (major_version > 1 || (major_version == 1 && minor_version >= 5))
     priv->has_randr15 = TRUE;


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