[mutter] idle-monitor: Use the XSync idle monitor under X11 nested



commit f3ee9be4cbb5cada9a125eaddb533847d90c4595
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 21 18:37:49 2014 -0400

    idle-monitor: Use the XSync idle monitor under X11 nested

 src/backends/meta-idle-monitor.c           |   22 ++++++++++++++--------
 src/backends/x11/meta-idle-monitor-xsync.c |    6 +++---
 src/core/events.c                          |    4 +++-
 3 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/src/backends/meta-idle-monitor.c b/src/backends/meta-idle-monitor.c
index 4c4357a..5e18f1b 100644
--- a/src/backends/meta-idle-monitor.c
+++ b/src/backends/meta-idle-monitor.c
@@ -163,10 +163,12 @@ meta_idle_monitor_init (MetaIdleMonitor *monitor)
 static GType
 get_idle_monitor_type (void)
 {
-  if (meta_is_wayland_compositor ())
-    return META_TYPE_IDLE_MONITOR_NATIVE;
-  else
+#if defined(CLUTTER_WINDOWING_X11)
+  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
     return META_TYPE_IDLE_MONITOR_XSYNC;
+#endif
+
+  return META_TYPE_IDLE_MONITOR_NATIVE;
 }
 
 static void
@@ -358,10 +360,14 @@ meta_idle_monitor_xsync_handle_xevent_all (XEvent *xevent)
 {
   int i;
 
-  if (meta_is_wayland_compositor ())
-    return;
-
   for (i = 0; i <= device_id_max; i++)
-    if (device_monitors[i])
-      meta_idle_monitor_xsync_handle_xevent (device_monitors[i], (XSyncAlarmNotifyEvent*)xevent);
+    {
+      if (device_monitors[i])
+        {
+          if (!META_IS_IDLE_MONITOR_XSYNC (device_monitors[i]))
+            return;
+
+          meta_idle_monitor_xsync_handle_xevent (device_monitors[i], (XSyncAlarmNotifyEvent*)xevent);
+        }
+    }
 }
diff --git a/src/backends/x11/meta-idle-monitor-xsync.c b/src/backends/x11/meta-idle-monitor-xsync.c
index afcbd96..c650618 100644
--- a/src/backends/x11/meta-idle-monitor-xsync.c
+++ b/src/backends/x11/meta-idle-monitor-xsync.c
@@ -25,6 +25,8 @@
 #include "meta-idle-monitor-xsync.h"
 #include "meta-idle-monitor-private.h"
 
+#include <clutter/x11/clutter-x11.h>
+
 #include <meta/util.h>
 #include "display-private.h"
 
@@ -192,9 +194,7 @@ meta_idle_monitor_xsync_constructed (GObject *object)
 {
   MetaIdleMonitorXSync *monitor_xsync = META_IDLE_MONITOR_XSYNC (object);
 
-  g_assert (!meta_is_wayland_compositor ());
-
-  monitor_xsync->display = meta_get_display ()->xdisplay;
+  monitor_xsync->display = clutter_x11_get_default_display ();;
   init_xsync (monitor_xsync);
 
   G_OBJECT_CLASS (meta_idle_monitor_xsync_parent_class)->constructed (object);
diff --git a/src/core/events.c b/src/core/events.c
index 8bf0ca2..90d346a 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -1877,8 +1877,10 @@ handle_idletime_for_event (const ClutterEvent *event)
   int device_id;
 
   /* This is handled by XSync under X11. */
-  if (!meta_is_wayland_compositor ())
+#if defined(CLUTTER_WINDOWING_X11)
+  if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
     return;
+#endif
 
   device = clutter_event_get_device (event);
   if (device == NULL)


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