[gnome-settings-daemon] power: tests: Correct use of XTestFakeKeyEvent()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: tests: Correct use of XTestFakeKeyEvent()
- Date: Fri, 25 Jan 2013 23:14:50 +0000 (UTC)
commit 3642332a8b337b0deec6bf5eab48358ab2e373e5
Author: Bastien Nocera <hadess hadess net>
Date: Sat Jan 26 00:13:38 2013 +0100
power: tests: Correct use of XTestFakeKeyEvent()
It expects a keycode, not a keysym.
https://bugzilla.gnome.org/show_bug.cgi?id=692556
plugins/power/gpm-common.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index 5c8a9f3..bf1b4e2 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -1622,10 +1622,20 @@ backlight_set_abs (GnomeRRScreen *rr_screen,
void
reset_idletime (void)
{
+ static gboolean inited = FALSE;
+ static KeyCode keycode1, keycode2;
+ static gboolean first_keycode = FALSE;
+
+ 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);
+ }
+
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);
+ XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), keycode1, True, 0);
+ XTestFakeKeyEvent (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), keycode2, False, 0);
+ first_keycode = !first_keycode;
gdk_error_trap_pop_ignored ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]