mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 07:30:42 -05:00
idle-monitor: Add ResetIdletime API, for testing purposes
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
This commit is contained in:
parent
657417a578
commit
01a0fa9437
@ -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);
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user