[gnome-settings-daemon/gnome-3-2] power: Call XSyncInitialize() in case GTK+ wasn't compiled with XSync support



commit 180d9965f7f4cf9d8496aee6c74b1dde8f994b95
Author: Richard Hughes <richard hughsie com>
Date:   Fri Oct 7 12:30:08 2011 +0100

    power: Call XSyncInitialize() in case GTK+ wasn't compiled with XSync support

 plugins/power/gpm-idletime.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/gpm-idletime.c b/plugins/power/gpm-idletime.c
index 215bdd1..b560bbe 100644
--- a/plugins/power/gpm-idletime.c
+++ b/plugins/power/gpm-idletime.c
@@ -395,6 +395,7 @@ gpm_idletime_init (GpmIdletime *idletime)
         int ncounters;
         XSyncSystemCounter *counters;
         GpmIdletimeAlarm *alarm_item;
+        gint major, minor;
         guint i;
 
         idletime->priv = GPM_IDLETIME_GET_PRIVATE (idletime);
@@ -414,7 +415,11 @@ gpm_idletime_init (GpmIdletime *idletime)
                 return;
         }
 
-        /* gtk_init should do XSyncInitialize for us */
+        /* check XSync is compatible with the server version */
+        if (!XSyncInitialize (idletime->priv->dpy, &major, &minor)) {
+                g_warning ("Sync extension not compatible.");
+                return;
+        }
         counters = XSyncListSystemCounters (idletime->priv->dpy,
                                             &ncounters);
         for (i = 0; i < ncounters && !idletime->priv->idle_counter; i++) {



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