2
* Copyright 2010 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* version 3 along with this program. If not, see
15
* <http://www.gnu.org/licenses/>
17
* Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
24
#include <dbus/dbus-glib.h>
28
#include "KeyboardUtil.h"
30
using namespace unity::ui;
32
void testKey (KeyboardUtil & key_util, Display *x_display, const char *key)
34
guint above_keycode = key_util.GetKeycodeAboveKeySymbol (XStringToKeysym(key));
36
KeySym above_keysym = XKeycodeToKeysym (x_display, above_keycode, 0);
37
if (above_keysym != NoSymbol)
38
printf ("Key above %s is %s\n", key, XKeysymToString(above_keysym));
40
printf ("Could not find key above %s!\n", key);
43
int main(int argc, char** argv)
45
Display* x_display = XOpenDisplay (NULL);
47
KeyboardUtil key_util (x_display);
48
testKey (key_util, x_display, "Tab");
49
testKey (key_util, x_display, "Shift_R");
50
testKey (key_util, x_display, "Control_L");
51
testKey (key_util, x_display, "space");
52
testKey (key_util, x_display, "comma");
53
testKey (key_util, x_display, "a");
54
testKey (key_util, x_display, "b");
55
testKey (key_util, x_display, "c");
56
testKey (key_util, x_display, "d");
57
testKey (key_util, x_display, "e");
58
testKey (key_util, x_display, "f");
59
testKey (key_util, x_display, "g");
60
testKey (key_util, x_display, "h");
61
testKey (key_util, x_display, "i");
62
testKey (key_util, x_display, "j");
63
testKey (key_util, x_display, "k");
64
testKey (key_util, x_display, "l");
65
testKey (key_util, x_display, "m");
66
testKey (key_util, x_display, "n");
67
testKey (key_util, x_display, "o");
68
testKey (key_util, x_display, "p");
69
testKey (key_util, x_display, "k");
70
testKey (key_util, x_display, "r");
71
testKey (key_util, x_display, "s");
72
testKey (key_util, x_display, "t");
73
testKey (key_util, x_display, "u");
74
testKey (key_util, x_display, "v");
75
testKey (key_util, x_display, "w");
76
testKey (key_util, x_display, "x");
77
testKey (key_util, x_display, "y");
78
testKey (key_util, x_display, "z");
b'\\ No newline at end of file'