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_xi2.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_xi2.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c | 283 |
1 files changed, 0 insertions, 283 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c deleted file mode 100644 index fbfbd43..0000000 --- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c +++ /dev/null | |||
@@ -1,283 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif /* ifdef HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include "Ecore.h" | ||
8 | #include "ecore_x_private.h" | ||
9 | #include "Ecore_X.h" | ||
10 | |||
11 | #ifdef ECORE_XI2 | ||
12 | #include "Ecore_Input.h" | ||
13 | #endif /* ifdef ECORE_XI2 */ | ||
14 | |||
15 | int _ecore_x_xi2_opcode = -1; | ||
16 | |||
17 | #ifndef XIPointerEmulated | ||
18 | #define XIPointerEmulated (1 << 16) | ||
19 | #endif | ||
20 | |||
21 | #ifdef ECORE_XI2 | ||
22 | static XIDeviceInfo *_ecore_x_xi2_devs = NULL; | ||
23 | static int _ecore_x_xi2_num = 0; | ||
24 | #endif /* ifdef ECORE_XI2 */ | ||
25 | |||
26 | void | ||
27 | _ecore_x_input_init(void) | ||
28 | { | ||
29 | #ifdef ECORE_XI2 | ||
30 | int event, error; | ||
31 | int major = 2, minor = 0; | ||
32 | |||
33 | if (!XQueryExtension(_ecore_x_disp, "XInputExtension", | ||
34 | &_ecore_x_xi2_opcode, &event, &error)) | ||
35 | { | ||
36 | _ecore_x_xi2_opcode = -1; | ||
37 | return; | ||
38 | } | ||
39 | |||
40 | if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest) | ||
41 | { | ||
42 | _ecore_x_xi2_opcode = -1; | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices, | ||
47 | &_ecore_x_xi2_num); | ||
48 | #endif /* ifdef ECORE_XI2 */ | ||
49 | } | ||
50 | |||
51 | void | ||
52 | _ecore_x_input_shutdown(void) | ||
53 | { | ||
54 | #ifdef ECORE_XI2 | ||
55 | if (_ecore_x_xi2_devs) | ||
56 | { | ||
57 | XIFreeDeviceInfo(_ecore_x_xi2_devs); | ||
58 | _ecore_x_xi2_devs = NULL; | ||
59 | } | ||
60 | |||
61 | _ecore_x_xi2_num = 0; | ||
62 | _ecore_x_xi2_opcode = -1; | ||
63 | #endif /* ifdef ECORE_XI2 */ | ||
64 | } | ||
65 | |||
66 | void | ||
67 | _ecore_x_input_handler(XEvent *xevent) | ||
68 | { | ||
69 | #ifdef ECORE_XI2 | ||
70 | XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data); | ||
71 | int devid = evd->deviceid; | ||
72 | int i; | ||
73 | |||
74 | if (_ecore_x_xi2_devs) | ||
75 | { | ||
76 | for (i = 0; i < _ecore_x_xi2_num; i++) | ||
77 | { | ||
78 | XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); | ||
79 | |||
80 | if (devid == dev->deviceid) | ||
81 | { | ||
82 | if (dev->use == XIMasterPointer) return; | ||
83 | if ((dev->use == XISlavePointer) && | ||
84 | (evd->flags & XIPointerEmulated)) return; | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | switch (xevent->xcookie.evtype) | ||
89 | { | ||
90 | case XI_Motion: | ||
91 | _ecore_mouse_move | ||
92 | (evd->time, | ||
93 | 0, // state | ||
94 | evd->event_x, evd->event_y, | ||
95 | evd->root_x, evd->root_y, | ||
96 | evd->event, | ||
97 | (evd->child ? evd->child : evd->event), | ||
98 | evd->root, | ||
99 | 1, // same_screen | ||
100 | devid, 1, 1, | ||
101 | 1.0, // pressure | ||
102 | 0.0, // angle | ||
103 | evd->event_x, evd->event_y, | ||
104 | evd->root_x, evd->root_y); | ||
105 | break; | ||
106 | |||
107 | case XI_ButtonPress: | ||
108 | _ecore_mouse_button | ||
109 | (ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
110 | evd->time, | ||
111 | 0, // state | ||
112 | 0, // button | ||
113 | evd->event_x, evd->event_y, | ||
114 | evd->root_x, evd->root_y, | ||
115 | evd->event, | ||
116 | (evd->child ? evd->child : evd->event), | ||
117 | evd->root, | ||
118 | 1, // same_screen | ||
119 | devid, 1, 1, | ||
120 | 1.0, // pressure | ||
121 | 0.0, // angle | ||
122 | evd->event_x, evd->event_y, | ||
123 | evd->root_x, evd->root_y); | ||
124 | break; | ||
125 | |||
126 | case XI_ButtonRelease: | ||
127 | _ecore_mouse_button | ||
128 | (ECORE_EVENT_MOUSE_BUTTON_UP, | ||
129 | evd->time, | ||
130 | 0, // state | ||
131 | 0, // button | ||
132 | evd->event_x, evd->event_y, | ||
133 | evd->root_x, evd->root_y, | ||
134 | evd->event, | ||
135 | (evd->child ? evd->child : evd->event), | ||
136 | evd->root, | ||
137 | 1, // same_screen | ||
138 | devid, 1, 1, | ||
139 | 1.0, // pressure | ||
140 | 0.0, // angle | ||
141 | evd->event_x, evd->event_y, | ||
142 | evd->root_x, evd->root_y); | ||
143 | break; | ||
144 | |||
145 | #ifdef XI_TouchUpdate | ||
146 | case XI_TouchUpdate: | ||
147 | _ecore_mouse_move | ||
148 | (evd->time, | ||
149 | 0, // state | ||
150 | evd->event_x, evd->event_y, | ||
151 | evd->root_x, evd->root_y, | ||
152 | evd->event, | ||
153 | (evd->child ? evd->child : evd->event), | ||
154 | evd->root, | ||
155 | 1, // same_screen | ||
156 | devid, 1, 1, | ||
157 | 1.0, // pressure | ||
158 | 0.0, // angle | ||
159 | evd->event_x, evd->event_y, | ||
160 | evd->root_x, evd->root_y); | ||
161 | break; | ||
162 | |||
163 | #endif | ||
164 | #ifdef XI_TouchBegin | ||
165 | case XI_TouchBegin: | ||
166 | _ecore_mouse_button | ||
167 | (ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
168 | evd->time, | ||
169 | 0, // state | ||
170 | 0, // button | ||
171 | evd->event_x, evd->event_y, | ||
172 | evd->root_x, evd->root_y, | ||
173 | evd->event, | ||
174 | (evd->child ? evd->child : evd->event), | ||
175 | evd->root, | ||
176 | 1, // same_screen | ||
177 | devid, 1, 1, | ||
178 | 1.0, // pressure | ||
179 | 0.0, // angle | ||
180 | evd->event_x, evd->event_y, | ||
181 | evd->root_x, evd->root_y); | ||
182 | break; | ||
183 | |||
184 | #endif | ||
185 | #ifdef XI_TouchEnd | ||
186 | case XI_TouchEnd: | ||
187 | _ecore_mouse_button | ||
188 | (ECORE_EVENT_MOUSE_BUTTON_UP, | ||
189 | evd->time, | ||
190 | 0, // state | ||
191 | 0, // button | ||
192 | evd->event_x, evd->event_y, | ||
193 | evd->root_x, evd->root_y, | ||
194 | evd->event, | ||
195 | (evd->child ? evd->child : evd->event), | ||
196 | evd->root, | ||
197 | 1, // same_screen | ||
198 | devid, 1, 1, | ||
199 | 1.0, // pressure | ||
200 | 0.0, // angle | ||
201 | evd->event_x, evd->event_y, | ||
202 | evd->root_x, evd->root_y); | ||
203 | break; | ||
204 | |||
205 | #endif | ||
206 | default: | ||
207 | break; | ||
208 | } | ||
209 | #endif /* ifdef ECORE_XI2 */ | ||
210 | } | ||
211 | |||
212 | EAPI Eina_Bool | ||
213 | ecore_x_input_multi_select(Ecore_X_Window win) | ||
214 | { | ||
215 | #ifdef ECORE_XI2 | ||
216 | int i; | ||
217 | Eina_Bool find = EINA_FALSE; | ||
218 | |||
219 | if (!_ecore_x_xi2_devs) | ||
220 | return 0; | ||
221 | |||
222 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
223 | for (i = 0; i < _ecore_x_xi2_num; i++) | ||
224 | { | ||
225 | XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); | ||
226 | |||
227 | if (dev->use == XIFloatingSlave) | ||
228 | { | ||
229 | XIEventMask eventmask; | ||
230 | unsigned char mask[4] = { 0 }; | ||
231 | |||
232 | eventmask.deviceid = dev->deviceid; | ||
233 | eventmask.mask_len = sizeof(mask); | ||
234 | eventmask.mask = mask; | ||
235 | XISetMask(mask, XI_ButtonPress); | ||
236 | XISetMask(mask, XI_ButtonRelease); | ||
237 | XISetMask(mask, XI_Motion); | ||
238 | XISelectEvents(_ecore_x_disp, win, &eventmask, 1); | ||
239 | find = EINA_TRUE; | ||
240 | } | ||
241 | else if (dev->use == XISlavePointer) | ||
242 | { | ||
243 | XIDeviceInfo *atdev = NULL; | ||
244 | int j; | ||
245 | |||
246 | for (j = 0; j < _ecore_x_xi2_num; j++) | ||
247 | { | ||
248 | if (_ecore_x_xi2_devs[j].deviceid == dev->attachment) | ||
249 | atdev = &(_ecore_x_xi2_devs[j]); | ||
250 | } | ||
251 | if (((atdev) && (atdev->use != XIMasterPointer)) || | ||
252 | (!atdev)) | ||
253 | { | ||
254 | XIEventMask eventmask; | ||
255 | unsigned char mask[4] = { 0 }; | ||
256 | |||
257 | eventmask.deviceid = dev->deviceid; | ||
258 | eventmask.mask_len = sizeof(mask); | ||
259 | eventmask.mask = mask; | ||
260 | XISetMask(mask, XI_ButtonPress); | ||
261 | XISetMask(mask, XI_ButtonRelease); | ||
262 | XISetMask(mask, XI_Motion); | ||
263 | # ifdef XI_TouchUpdate | ||
264 | XISetMask(mask, XI_TouchUpdate); | ||
265 | # endif | ||
266 | # ifdef XI_TouchBegin | ||
267 | XISetMask(mask, XI_TouchBegin); | ||
268 | # endif | ||
269 | # ifdef XI_TouchEnd | ||
270 | XISetMask(mask, XI_TouchEnd); | ||
271 | # endif | ||
272 | XISelectEvents(_ecore_x_disp, win, &eventmask, 1); | ||
273 | find = EINA_TRUE; | ||
274 | } | ||
275 | } | ||
276 | } | ||
277 | |||
278 | return find; | ||
279 | #else /* ifdef ECORE_XI2 */ | ||
280 | return EINA_FALSE; | ||
281 | #endif /* ifdef ECORE_XI2 */ | ||
282 | } | ||
283 | |||