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

This commit is contained in:
Jasper St. Pierre 2014-04-21 18:37:49 -04:00
parent 2d6bcf3885
commit f3ee9be4cb
3 changed files with 20 additions and 12 deletions

View File

@ -163,10 +163,12 @@ meta_idle_monitor_init (MetaIdleMonitor *monitor)
static GType static GType
get_idle_monitor_type (void) get_idle_monitor_type (void)
{ {
if (meta_is_wayland_compositor ()) #if defined(CLUTTER_WINDOWING_X11)
return META_TYPE_IDLE_MONITOR_NATIVE; if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
else
return META_TYPE_IDLE_MONITOR_XSYNC; return META_TYPE_IDLE_MONITOR_XSYNC;
#endif
return META_TYPE_IDLE_MONITOR_NATIVE;
} }
static void static void
@ -358,10 +360,14 @@ meta_idle_monitor_xsync_handle_xevent_all (XEvent *xevent)
{ {
int i; int i;
if (meta_is_wayland_compositor ())
return;
for (i = 0; i <= device_id_max; i++) 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);
}
}
} }

View File

@ -25,6 +25,8 @@
#include "meta-idle-monitor-xsync.h" #include "meta-idle-monitor-xsync.h"
#include "meta-idle-monitor-private.h" #include "meta-idle-monitor-private.h"
#include <clutter/x11/clutter-x11.h>
#include <meta/util.h> #include <meta/util.h>
#include "display-private.h" #include "display-private.h"
@ -192,9 +194,7 @@ meta_idle_monitor_xsync_constructed (GObject *object)
{ {
MetaIdleMonitorXSync *monitor_xsync = META_IDLE_MONITOR_XSYNC (object); MetaIdleMonitorXSync *monitor_xsync = META_IDLE_MONITOR_XSYNC (object);
g_assert (!meta_is_wayland_compositor ()); monitor_xsync->display = clutter_x11_get_default_display ();;
monitor_xsync->display = meta_get_display ()->xdisplay;
init_xsync (monitor_xsync); init_xsync (monitor_xsync);
G_OBJECT_CLASS (meta_idle_monitor_xsync_parent_class)->constructed (object); G_OBJECT_CLASS (meta_idle_monitor_xsync_parent_class)->constructed (object);

View File

@ -1877,8 +1877,10 @@ handle_idletime_for_event (const ClutterEvent *event)
int device_id; int device_id;
/* This is handled by XSync under X11. */ /* 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; return;
#endif
device = clutter_event_get_device (event); device = clutter_event_get_device (event);
if (device == NULL) if (device == NULL)