MetaIdleMonitor: add wayland support

Keep a timer source that we reset when we capture an event in
MetaWayland, and fire watches accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=706005
This commit is contained in:
Giovanni Campagna
2013-08-23 15:07:57 +02:00
parent c0acf3ae6d
commit 9affbf10a6
3 changed files with 146 additions and 10 deletions

View File

@@ -49,6 +49,7 @@
#include <meta/types.h>
#include <meta/main.h>
#include "frame.h"
#include "meta-idle-monitor-private.h"
static MetaWaylandCompositor _meta_wayland_compositor;
@@ -1260,6 +1261,31 @@ synthesize_motion_event (MetaWaylandCompositor *compositor,
meta_display_handle_event (display, (XEvent *) &generic_event);
}
static void
reset_idletimes (const ClutterEvent *event)
{
ClutterInputDevice *device, *source_device;
MetaIdleMonitor *core_monitor, *device_monitor;
int device_id;
device = clutter_event_get_device (event);
device_id = clutter_input_device_get_device_id (device);
core_monitor = meta_idle_monitor_get_core ();
device_monitor = meta_idle_monitor_get_for_device (device_id);
meta_idle_monitor_reset_idletime (core_monitor);
meta_idle_monitor_reset_idletime (device_monitor);
source_device = clutter_event_get_source_device (event);
if (source_device != device)
{
device_id = clutter_input_device_get_device_id (device);
device_monitor = meta_idle_monitor_get_for_device (device_id);
meta_idle_monitor_reset_idletime (device_monitor);
}
}
static gboolean
event_cb (ClutterActor *stage,
const ClutterEvent *event,
@@ -1270,6 +1296,8 @@ event_cb (ClutterActor *stage,
MetaWaylandSurface *surface;
MetaDisplay *display;
reset_idletimes (event);
meta_wayland_seat_handle_event (compositor->seat, event);
/* HACK: for now, the surfaces from Wayland clients aren't