[gnome-settings-daemon/gnome-3-10] power: Fix wakeup with some keymaps
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-10] power: Fix wakeup with some keymaps
- Date: Mon, 5 May 2014 13:50:28 +0000 (UTC)
commit 9080e84b3664a1f8d12f46bcfad94bb9740b927b
Author: Bastien Nocera <hadess hadess net>
Date: Fri May 2 12:28:26 2014 +0200
power: Fix wakeup with some keymaps
When trying to wake up the screen, try to use XF86WakeUp in preference
to the left Alt. Don't use the right Alt key as it might be set as the
Compose key which would eat the event without resetting the idle.
Also make sure to initialise the keycode only once.
https://bugzilla.gnome.org/show_bug.cgi?id=729375
plugins/power/gpm-common.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 54838b6..5bb8b46 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -1630,20 +1630,18 @@ backlight_set_abs (GnomeRRScreen *rr_screen,
void
reset_idletime (void)
{
- static gboolean inited = FALSE;
- static KeyCode keycode1, keycode2;
- static gboolean first_keycode = FALSE;
+ static KeyCode keycode;
- if (inited == FALSE) {
- keycode1 = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_KEY_Alt_L);
- keycode2 = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_KEY_Alt_R);
+ if (keycode == 0) {
+ keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_KEY_WakeUp);
+ if (keycode == 0)
+ keycode = XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
GDK_KEY_Alt_L);
}
gdk_error_trap_push ();
- /* send a left or right alt key; first press, then release */
- XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), first_keycode ? keycode1 :
keycode2, True, CurrentTime);
- XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), first_keycode ? keycode1 :
keycode2, False, CurrentTime);
- first_keycode = !first_keycode;
+ /* send a wakeup or left alt key; first press, then release */
+ XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), keycode, True, CurrentTime);
+ XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), keycode, False, CurrentTime);
gdk_error_trap_pop_ignored ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]