[mutter/wayland] idle-monitor: Move reset_idletime handling to events.c
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] idle-monitor: Move reset_idletime handling to events.c
- Date: Mon, 31 Mar 2014 03:11:34 +0000 (UTC)
commit 1e2bdcc3c5cbf8df59e0fb3ddfb2f4cfe6d909ce
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Mar 30 20:50:03 2014 -0400
idle-monitor: Move reset_idletime handling to events.c
It's not specific to the Wayland protocol at all, and it's not really
a Wayland compositor thing. This should eventually be in the native
backend.
src/core/events.c | 34 ++++++++++++++++++++++++++++++++++
src/wayland/meta-wayland-surface.c | 1 -
src/wayland/meta-wayland.c | 25 -------------------------
3 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/src/core/events.c b/src/core/events.c
index aaf97f9..3d113bd 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -1850,6 +1850,38 @@ meta_display_handle_xevent (MetaDisplay *display,
return bypass_gtk;
}
+static void
+handle_idletime_for_event (const ClutterEvent *event)
+{
+ ClutterInputDevice *device, *source_device;
+ MetaIdleMonitor *core_monitor, *device_monitor;
+ int device_id;
+
+ /* This is handled by XSync under X11. */
+ if (!meta_is_wayland_compositor ())
+ return;
+
+ device = clutter_event_get_device (event);
+ if (device == NULL)
+ return;
+
+ 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
meta_display_handle_event (MetaDisplay *display,
const ClutterEvent *event)
@@ -1864,6 +1896,8 @@ meta_display_handle_event (MetaDisplay *display,
meta_wayland_compositor_update (compositor, event);
}
+ handle_idletime_for_event (event);
+
window = get_window_for_event (display, event);
display->current_time = event->any.time;
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 39239ef..77ea2e5 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -55,7 +55,6 @@
#include <meta/types.h>
#include <meta/main.h>
#include "frame.h"
-#include "meta-idle-monitor-private.h"
#include "monitor-private.h"
#include "meta-surface-actor.h"
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 12c1935..6a4a0ce 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -51,7 +51,6 @@
#include <meta/types.h>
#include <meta/main.h>
#include "frame.h"
-#include "meta-idle-monitor-private.h"
#include "meta-weston-launch.h"
#include "monitor-private.h"
@@ -520,30 +519,6 @@ void
meta_wayland_compositor_update (MetaWaylandCompositor *compositor,
const ClutterEvent *event)
{
- ClutterInputDevice *device, *source_device;
- MetaIdleMonitor *core_monitor, *device_monitor;
- int device_id;
-
- device = clutter_event_get_device (event);
- if (device == NULL)
- return;
-
- 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);
- }
-
meta_wayland_seat_update (compositor->seat, event);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]