diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c | 167 |
1 files changed, 0 insertions, 167 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c deleted file mode 100644 index 23eea10..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c +++ /dev/null | |||
@@ -1,167 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif /* ifdef HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | |||
7 | #ifdef ECORE_XTEST | ||
8 | # include <X11/extensions/XTest.h> | ||
9 | #endif /* ifdef ECORE_XTEST */ | ||
10 | |||
11 | #include "ecore_x_private.h" | ||
12 | #include "Ecore_X.h" | ||
13 | #include <string.h> | ||
14 | |||
15 | EAPI Eina_Bool | ||
16 | #ifdef ECORE_XTEST | ||
17 | ecore_x_test_fake_key_down(const char *key) | ||
18 | #else | ||
19 | ecore_x_test_fake_key_down(const char *key __UNUSED__) | ||
20 | #endif | ||
21 | { | ||
22 | #ifdef ECORE_XTEST | ||
23 | KeyCode keycode = 0; | ||
24 | KeySym keysym; | ||
25 | |||
26 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
27 | if (!strncmp(key, "Keycode-", 8)) | ||
28 | keycode = atoi(key + 8); | ||
29 | else | ||
30 | { | ||
31 | keysym = XStringToKeysym(key); | ||
32 | if (keysym == NoSymbol) | ||
33 | return EINA_FALSE; | ||
34 | |||
35 | keycode = XKeysymToKeycode(_ecore_x_disp, keysym); | ||
36 | } | ||
37 | |||
38 | if (keycode == 0) | ||
39 | return EINA_FALSE; | ||
40 | |||
41 | return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0) ? EINA_TRUE : EINA_FALSE; | ||
42 | #else /* ifdef ECORE_XTEST */ | ||
43 | return EINA_FALSE; | ||
44 | #endif /* ifdef ECORE_XTEST */ | ||
45 | } | ||
46 | |||
47 | EAPI Eina_Bool | ||
48 | #ifdef ECORE_XTEST | ||
49 | ecore_x_test_fake_key_up(const char *key) | ||
50 | #else | ||
51 | ecore_x_test_fake_key_up(const char *key __UNUSED__) | ||
52 | #endif | ||
53 | { | ||
54 | #ifdef ECORE_XTEST | ||
55 | KeyCode keycode = 0; | ||
56 | KeySym keysym; | ||
57 | |||
58 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
59 | if (!strncmp(key, "Keycode-", 8)) | ||
60 | keycode = atoi(key + 8); | ||
61 | else | ||
62 | { | ||
63 | keysym = XStringToKeysym(key); | ||
64 | if (keysym == NoSymbol) | ||
65 | return EINA_FALSE; | ||
66 | |||
67 | keycode = XKeysymToKeycode(_ecore_x_disp, keysym); | ||
68 | } | ||
69 | |||
70 | if (keycode == 0) | ||
71 | return EINA_FALSE; | ||
72 | |||
73 | return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0) ? EINA_TRUE : EINA_FALSE; | ||
74 | #else /* ifdef ECORE_XTEST */ | ||
75 | return EINA_FALSE; | ||
76 | #endif /* ifdef ECORE_XTEST */ | ||
77 | } | ||
78 | |||
79 | EAPI Eina_Bool | ||
80 | #ifdef ECORE_XTEST | ||
81 | ecore_x_test_fake_key_press(const char *key) | ||
82 | #else | ||
83 | ecore_x_test_fake_key_press(const char *key __UNUSED__) | ||
84 | #endif | ||
85 | { | ||
86 | #ifdef ECORE_XTEST | ||
87 | KeyCode keycode = 0; | ||
88 | KeySym keysym = 0; | ||
89 | int shift = 0; | ||
90 | |||
91 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
92 | if (!strncmp(key, "Keycode-", 8)) | ||
93 | keycode = atoi(key + 8); | ||
94 | else | ||
95 | { | ||
96 | keysym = XStringToKeysym(key); | ||
97 | if (keysym == NoSymbol) | ||
98 | return EINA_FALSE; | ||
99 | |||
100 | keycode = XKeysymToKeycode(_ecore_x_disp, keysym); | ||
101 | if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym) | ||
102 | { | ||
103 | if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym) | ||
104 | shift = 1; | ||
105 | else | ||
106 | keycode = 0; | ||
107 | } | ||
108 | else | ||
109 | shift = 0; | ||
110 | } | ||
111 | |||
112 | if (keycode == 0) | ||
113 | { | ||
114 | static int mod = 0; | ||
115 | KeySym *keysyms; | ||
116 | int keycode_min, keycode_max, keycode_num; | ||
117 | int i; | ||
118 | |||
119 | XDisplayKeycodes(_ecore_x_disp, &keycode_min, &keycode_max); | ||
120 | keysyms = XGetKeyboardMapping(_ecore_x_disp, keycode_min, | ||
121 | keycode_max - keycode_min + 1, | ||
122 | &keycode_num); | ||
123 | mod = (mod + 1) & 0x7; | ||
124 | i = (keycode_max - keycode_min - mod - 1) * keycode_num; | ||
125 | |||
126 | keysyms[i] = keysym; | ||
127 | XChangeKeyboardMapping(_ecore_x_disp, keycode_min, keycode_num, | ||
128 | keysyms, (keycode_max - keycode_min)); | ||
129 | XFree(keysyms); | ||
130 | XSync(_ecore_x_disp, False); | ||
131 | keycode = keycode_max - mod - 1; | ||
132 | } | ||
133 | |||
134 | if (shift) | ||
135 | XTestFakeKeyEvent(_ecore_x_disp, | ||
136 | XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0); | ||
137 | |||
138 | XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0); | ||
139 | XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0); | ||
140 | if (shift) | ||
141 | XTestFakeKeyEvent(_ecore_x_disp, | ||
142 | XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0); | ||
143 | |||
144 | return EINA_TRUE; | ||
145 | #else /* ifdef ECORE_XTEST */ | ||
146 | return EINA_FALSE; | ||
147 | #endif /* ifdef ECORE_XTEST */ | ||
148 | } | ||
149 | |||
150 | EAPI const char * | ||
151 | ecore_x_keysym_string_get(int keysym) | ||
152 | { | ||
153 | return XKeysymToString(keysym); | ||
154 | } | ||
155 | |||
156 | EAPI int | ||
157 | ecore_x_keysym_keycode_get(const char *keyname) | ||
158 | { | ||
159 | int keycode = 0; | ||
160 | |||
161 | if (!strncmp(keyname, "Keycode-", 8)) | ||
162 | keycode = atoi(keyname + 8); | ||
163 | else | ||
164 | keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(keyname)); | ||
165 | |||
166 | return keycode; | ||
167 | } | ||