[gnome-flashback/wip/randr-1.5: 1/7] display-config: add a flag to denote randr 1.5 is in use



commit 1cea9ac75ccc8b13f44e121ca73c5fec7d0b0965
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Jun 4 01:40:39 2015 +0300

    display-config: add a flag to denote randr 1.5 is in use
    
    If the server reports randr 1.5, just cache the information
    for later patches to use.
    
    Based on:
    https://git.gnome.org/browse/mutter/commit/?id=ef296031cbf0883135b7a1f436c6a69f75122efe

 configure.ac                                       |    2 ++
 .../libdisplay-config/flashback-monitor-manager.c  |   13 +++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 07688d7..b3c77e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,8 @@ PKG_CHECK_MODULES(WORKAROUNDS, glib-2.0 >= $GLIB_REQUIRED gtk+-3.0 >= $GTK_REQUI
 AC_SUBST(WORKAROUNDS_CFLAGS)
 AC_SUBST(WORKAROUNDS_LIBS)
 
+PKG_CHECK_EXISTS([xrandr >= 1.5.0], AC_DEFINE([HAVE_XRANDR15], [1], [Define if you have support for XRandR 
1.5 or greater]))
+
 AC_CONFIG_FILES([
 Makefile
 data/Makefile
diff --git a/gnome-flashback/libdisplay-config/flashback-monitor-manager.c 
b/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
index c770707..6cf127a 100644
--- a/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
+++ b/gnome-flashback/libdisplay-config/flashback-monitor-manager.c
@@ -56,6 +56,8 @@ struct _FlashbackMonitorManagerPrivate
   int                    rr_event_base;
   int                    rr_error_base;
 
+  gboolean               has_randr15;
+
   MetaDBusDisplayConfig *display_config;
 };
 
@@ -1199,6 +1201,8 @@ static void
 flashback_monitor_manager_init (FlashbackMonitorManager *manager)
 {
   FlashbackMonitorManagerPrivate *priv;
+  int major_version;
+  int minor_version;
 
   priv = flashback_monitor_manager_get_instance_private (manager);
   manager->priv = priv;
@@ -1215,6 +1219,15 @@ flashback_monitor_manager_init (FlashbackMonitorManager *manager)
   XRRSelectInput (priv->xdisplay, DefaultRootWindow (priv->xdisplay),
                   RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask |
                   RROutputPropertyNotifyMask);
+
+  priv->has_randr15 = FALSE;
+
+  XRRQueryVersion (priv->xdisplay, &major_version, &minor_version);
+
+#ifdef HAVE_XRANDR15
+  if (major_version > 1 || (major_version == 1 && minor_version >= 5))
+    priv->has_randr15 = TRUE;
+#endif
 }
 
 FlashbackMonitorManager *


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