diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-03-21 14:11:39 +0100 |
---|---|---|
committer | Jonas Ã…dahl <jadahl@gmail.com> | 2018-04-16 13:28:03 +0200 |
commit | 01a0fa9437b9d4ca74e39b6e8e256fc5f05187d2 (patch) | |
tree | d82f53465c3a5be32c7d8c02c3e7beb73e70f70c | |
parent | 657417a578f6d9457a837add8105bf6c08710236 (diff) | |
download | mutter-wip/idletime-inhibitors.tar.gz |
idle-monitor: Add ResetIdletime API, for testing purposeswip/idletime-inhibitors
The ResetIdletime API can be used instead of an "XTest" binary to
programmatically reset the idle time, as if the user pressed a button on
a keyboard.
This is necessary since we stopped using the XSync extension to monitor
idletimes, as it didn't consider inhibitors as busy, and mutter's
clutter code ignores "Core Events" as generated by XTest.
This patch will require minimal changes to gnome-settings-daemon's power
test suite so that "key press" idletime resets are triggered through
this D-Bus interface rather than through XTest and a roundtrip through
the X server.
https://bugzilla.gnome.org/show_bug.cgi?id=705942
-rw-r--r-- | src/backends/meta-idle-monitor-dbus.c | 23 | ||||
-rw-r--r-- | src/org.gnome.Mutter.IdleMonitor.xml | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/backends/meta-idle-monitor-dbus.c b/src/backends/meta-idle-monitor-dbus.c index a0e8ec1cb..e01d6dda6 100644 --- a/src/backends/meta-idle-monitor-dbus.c +++ b/src/backends/meta-idle-monitor-dbus.c @@ -24,6 +24,7 @@ #include "meta-idle-monitor-dbus.h" #include <meta/meta-idle-monitor.h> +#include <backends/meta-idle-monitor-private.h> #include "meta-dbus-idle-monitor.h" #include <clutter/clutter.h> @@ -43,6 +44,26 @@ handle_get_idletime (MetaDBusIdleMonitor *skeleton, return TRUE; } +static gboolean +handle_reset_idletime (MetaDBusIdleMonitor *skeleton, + GDBusMethodInvocation *invocation, + MetaIdleMonitor *monitor) +{ + if (!g_getenv ("MUTTER_DEBUG_RESET_IDLETIME")) + { + g_dbus_method_invocation_return_error_literal (invocation, + G_DBUS_ERROR, + G_DBUS_ERROR_UNKNOWN_METHOD, + "No such method"); + return FALSE; + } + + meta_idle_monitor_reset_idletime (meta_idle_monitor_get_core ()); + meta_dbus_idle_monitor_complete_reset_idletime (skeleton, invocation); + + return TRUE; +} + typedef struct { MetaDBusIdleMonitor *dbus_monitor; MetaIdleMonitor *monitor; @@ -173,6 +194,8 @@ create_monitor_skeleton (GDBusObjectManagerServer *manager, G_CALLBACK (handle_add_user_active_watch), monitor, 0); g_signal_connect_object (skeleton, "handle-remove-watch", G_CALLBACK (handle_remove_watch), monitor, 0); + g_signal_connect_object (skeleton, "handle-reset-idletime", + G_CALLBACK (handle_reset_idletime), monitor, 0); g_signal_connect_object (skeleton, "handle-get-idletime", G_CALLBACK (handle_get_idletime), monitor, 0); diff --git a/src/org.gnome.Mutter.IdleMonitor.xml b/src/org.gnome.Mutter.IdleMonitor.xml index 34a26dd93..374af4dc4 100644 --- a/src/org.gnome.Mutter.IdleMonitor.xml +++ b/src/org.gnome.Mutter.IdleMonitor.xml @@ -28,6 +28,8 @@ <arg name="id" direction="in" type="u" /> </method> + <method name="ResetIdletime"/> + <signal name="WatchFired"> <arg name="id" direction="out" type="u" /> </signal> |