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.
This commit is contained in:
parent
490e1c8c3b
commit
1e2bdcc3c5
@ -1850,6 +1850,38 @@ meta_display_handle_xevent (MetaDisplay *display,
|
|||||||
return bypass_gtk;
|
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
|
static gboolean
|
||||||
meta_display_handle_event (MetaDisplay *display,
|
meta_display_handle_event (MetaDisplay *display,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
@ -1864,6 +1896,8 @@ meta_display_handle_event (MetaDisplay *display,
|
|||||||
meta_wayland_compositor_update (compositor, event);
|
meta_wayland_compositor_update (compositor, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handle_idletime_for_event (event);
|
||||||
|
|
||||||
window = get_window_for_event (display, event);
|
window = get_window_for_event (display, event);
|
||||||
|
|
||||||
display->current_time = event->any.time;
|
display->current_time = event->any.time;
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#include <meta/types.h>
|
#include <meta/types.h>
|
||||||
#include <meta/main.h>
|
#include <meta/main.h>
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "meta-idle-monitor-private.h"
|
|
||||||
#include "monitor-private.h"
|
#include "monitor-private.h"
|
||||||
|
|
||||||
#include "meta-surface-actor.h"
|
#include "meta-surface-actor.h"
|
||||||
|
@ -51,7 +51,6 @@
|
|||||||
#include <meta/types.h>
|
#include <meta/types.h>
|
||||||
#include <meta/main.h>
|
#include <meta/main.h>
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "meta-idle-monitor-private.h"
|
|
||||||
#include "meta-weston-launch.h"
|
#include "meta-weston-launch.h"
|
||||||
#include "monitor-private.h"
|
#include "monitor-private.h"
|
||||||
|
|
||||||
@ -520,30 +519,6 @@ void
|
|||||||
meta_wayland_compositor_update (MetaWaylandCompositor *compositor,
|
meta_wayland_compositor_update (MetaWaylandCompositor *compositor,
|
||||||
const ClutterEvent *event)
|
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);
|
meta_wayland_seat_update (compositor->seat, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user