diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-01-19 01:56:32 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-01-21 18:01:42 +0100 |
commit | d14cc2ed60b671d2b1709e9fa12c78f2f0783541 (patch) | |
tree | 88b4db200f7979465e9a970a4bf32dc9ab85fef5 | |
parent | 652d54ab3f686573def8f0a540f67fbf79f6ae02 (diff) | |
download | gnome-settings-daemon-d14cc2ed60b671d2b1709e9fa12c78f2f0783541.tar.gz |
power: Add hack to reset IDLETIME counter
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | plugins/power/gpm-common.c | 11 | ||||
-rw-r--r-- | plugins/power/gpm-common.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index d33ace05..dcf59838 100644 --- a/configure.ac +++ b/configure.ac @@ -234,7 +234,7 @@ PKG_CHECK_MODULES(SOUND, [libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-m # --------------------------------------------------------------------------- # Power # --------------------------------------------------------------------------- -PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext) +PKG_CHECK_MODULES(POWER, upower-glib >= $UPOWER_REQUIRED_VERSION gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION libcanberra-gtk3 libnotify x11 xext xtst) if test x$have_gudev != xno; then PKG_CHECK_MODULES(BACKLIGHT_HELPER, diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c index 73609423..3bd8dc30 100644 --- a/plugins/power/gpm-common.c +++ b/plugins/power/gpm-common.c @@ -28,6 +28,7 @@ #include <glib.h> #include <glib/gi18n.h> #include <gdk/gdkx.h> +#include <X11/extensions/XTest.h> #define GNOME_DESKTOP_USE_UNSTABLE_API #include <libgnome-desktop/gnome-rr.h> @@ -1577,3 +1578,13 @@ backlight_set_abs (GnomeRRScreen *rr_screen, return ret; } + +void +reset_idletime (void) +{ + gdk_error_trap_push (); + /* send a left shift key; first press, then release */ + XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_KEY_Shift_L, True, 0); + XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_KEY_Shift_L, False, 0); + gdk_error_trap_pop_ignored (); +} diff --git a/plugins/power/gpm-common.h b/plugins/power/gpm-common.h index d90424e9..b949404a 100644 --- a/plugins/power/gpm-common.h +++ b/plugins/power/gpm-common.h @@ -43,6 +43,7 @@ gchar *gpm_upower_get_device_description (UpDevice *device) /* Power helpers */ gboolean gsd_power_is_hardware_a_vm (void); guint gsd_power_enable_screensaver_watchdog (void); +void reset_idletime (void); /* Backlight helpers */ |