[gnome-settings-daemon] tests: Correct use of XTestFakeKeyEvent()



commit cbf2d17cdc535fe6c2cdb4e64fadbfae756e4b67
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Jan 26 00:13:11 2013 +0100

    tests: Correct use of XTestFakeKeyEvent()
    
    It expects a keycode, not a keysym.

 tests/shiftkey.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/tests/shiftkey.c b/tests/shiftkey.c
index f02fc93..a0e76aa 100644
--- a/tests/shiftkey.c
+++ b/tests/shiftkey.c
@@ -34,6 +34,7 @@ main()
 {
         Display *display = NULL;
         int event_base, error_base, major_version, minor_version;
+        KeyCode keycode;
 
         display = XOpenDisplay (NULL);
 
@@ -48,8 +49,9 @@ main()
         }
 
         /* send a left shift key; first press, then release */
-        XTestFakeKeyEvent (display, XK_Shift_L, True, 0);
-        XTestFakeKeyEvent (display, XK_Shift_L, False, 0);
+        keycode = XKeysymToKeycode (display, XK_Shift_L);
+        XTestFakeKeyEvent (display, keycode, True, 0);
+        XTestFakeKeyEvent (display, keycode, False, 0);
 
         XCloseDisplay (display);
         return 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]