Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 3772:9087a84cba51 gsoc2008_manymouse
First comments and code upgrades in X11
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Sat, 02 Aug 2008 17:40:49 +0000 |
parents | 2970fcfbdd54 |
children | 3b5691f85c0d |
comparison
equal
deleted
inserted
replaced
3771:8cc36a399a12 | 3772:9087a84cba51 |
---|---|
25 #include "SDL_mouse.h" | 25 #include "SDL_mouse.h" |
26 #include "../SDL_sysvideo.h" | 26 #include "../SDL_sysvideo.h" |
27 #include "../SDL_pixels_c.h" | 27 #include "../SDL_pixels_c.h" |
28 | 28 |
29 #include "SDL_x11video.h" | 29 #include "SDL_x11video.h" |
30 //#include "SDL_d3drender.h" | 30 /*#include "SDL_d3drender.h" |
31 //#include "SDL_gdirender.h" | 31 #include "SDL_gdirender.h"*/ |
32 | 32 |
33 XDevice **SDL_XDevices; | 33 XDevice **SDL_XDevices; |
34 int SDL_NumOfXDevices; | 34 int SDL_NumOfXDevices; |
35 XEventClass SDL_XEvents[256]; | 35 XEventClass SDL_XEvents[256]; |
36 int SDL_NumOfXEvents; | 36 int SDL_NumOfXEvents; |
37 int motion, button_pressed, button_released; | 37 |
38 int motion, button_pressed, button_released;/*the definitions of the mice events*/ | |
38 int proximity_in, proximity_out; | 39 int proximity_in, proximity_out; |
39 | 40 |
40 /* Initialization/Query functions */ | 41 /* Initialization/Query functions */ |
41 static int X11_VideoInit(_THIS); | 42 static int X11_VideoInit(_THIS); |
42 static void X11_VideoQuit(_THIS); | 43 static void X11_VideoQuit(_THIS); |
247 | 248 |
248 if (X11_InitKeyboard(_this) != 0) { | 249 if (X11_InitKeyboard(_this) != 0) { |
249 return -1; | 250 return -1; |
250 } | 251 } |
251 X11_InitMouse(_this); | 252 X11_InitMouse(_this); |
253 /*we're generating the table of events that should be recognized*/ | |
252 for(i=0;i<SDL_NumOfXDevices;++i) | 254 for(i=0;i<SDL_NumOfXDevices;++i) |
253 { | 255 { |
254 DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent); | 256 DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent); |
255 if (xEvent) SDL_XEvents[index++] = xEvent; | 257 if (xEvent) SDL_XEvents[index++] = xEvent; |
256 DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent); | 258 DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent); |
257 if (xEvent) SDL_XEvents[index++] = xEvent; | 259 if (xEvent) SDL_XEvents[index++] = xEvent; |
258 | 260 |
259 /* focus events */ | 261 /*focus events*/ |
260 DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent); | 262 DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent); |
261 if (xEvent) SDL_XEvents[index++] = xEvent; | 263 if (xEvent) SDL_XEvents[index++] = xEvent; |
262 DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent); | 264 DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent); |
263 if (xEvent) SDL_XEvents[index++] = xEvent; | 265 if (xEvent) SDL_XEvents[index++] = xEvent; |
264 | 266 |
265 /* button events */ | 267 /*button events*/ |
266 DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent); | 268 DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent); |
267 if (xEvent) | 269 if (xEvent) |
268 { | 270 { |
269 SDL_XEvents[index++] = xEvent; | 271 SDL_XEvents[index++] = xEvent; |
270 button_pressed=c_not_needed; | 272 button_pressed=c_not_needed; |
274 { | 276 { |
275 SDL_XEvents[index++] = xEvent; | 277 SDL_XEvents[index++] = xEvent; |
276 button_released=c_not_needed; | 278 button_released=c_not_needed; |
277 } | 279 } |
278 | 280 |
279 /* proximity events */ | 281 /*proximity events*/ |
280 ProximityIn(SDL_XDevices[i],c_not_needed,xEvent); | 282 ProximityIn(SDL_XDevices[i],c_not_needed,xEvent); |
281 if (xEvent) | 283 if (xEvent) |
282 { | 284 { |
283 SDL_XEvents[index++] = xEvent; | 285 SDL_XEvents[index++] = xEvent; |
284 proximity_in=c_not_needed; | 286 proximity_in=c_not_needed; |
287 if (xEvent) | 289 if (xEvent) |
288 { | 290 { |
289 SDL_XEvents[index++] = xEvent; | 291 SDL_XEvents[index++] = xEvent; |
290 proximity_out=c_not_needed; | 292 proximity_out=c_not_needed; |
291 } | 293 } |
292 /* motion events */ | 294 /*motion events*/ |
293 DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent); | 295 DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent); |
294 if (xEvent) | 296 if (xEvent) |
295 { | 297 { |
296 SDL_XEvents[index++] = xEvent; | 298 SDL_XEvents[index++] = xEvent; |
297 motion=c_not_needed; | 299 motion=c_not_needed; |
298 } | 300 } |
299 | 301 |
300 /* device state */ | 302 /*device state*/ |
301 DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent); | 303 DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent); |
302 if (xEvent) SDL_XEvents[index++] = xEvent; | 304 if (xEvent) SDL_XEvents[index++] = xEvent; |
303 DeviceMappingNotify(SDL_XDevices[i], | 305 DeviceMappingNotify(SDL_XDevices[i], |
304 c_not_needed,xEvent); | 306 c_not_needed,xEvent); |
305 if (xEvent) SDL_XEvents[index++] = xEvent; | 307 if (xEvent) SDL_XEvents[index++] = xEvent; |
311 DevicePointerMotionHint(SDL_XDevices[i], | 313 DevicePointerMotionHint(SDL_XDevices[i], |
312 c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent); | 314 c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent); |
313 if (xEvent) SDL_XEvents[index++] = xEvent; | 315 if (xEvent) SDL_XEvents[index++] = xEvent; |
314 #endif | 316 #endif |
315 | 317 |
316 /* button motion */ | 318 /*button motion*/ |
317 DeviceButtonMotion(SDL_XDevices[i], | 319 DeviceButtonMotion(SDL_XDevices[i], |
318 c_not_needed,xEvent); | 320 c_not_needed,xEvent); |
319 if (xEvent) SDL_XEvents[index++] = xEvent; | 321 if (xEvent) SDL_XEvents[index++] = xEvent; |
320 DeviceButton1Motion(SDL_XDevices[i], | 322 DeviceButton1Motion(SDL_XDevices[i], |
321 c_not_needed,xEvent); | 323 c_not_needed,xEvent); |