Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11video.c @ 2710:44e49d3fa6cf
Final merge of Google Summer of Code 2008 work...
Many-mouse and tablet support
by Szymon Wilczek, mentored by Ryan C. Gordon
Everything concerning the project is noted on the wiki:
http://wilku.ravenlord.ws/doku.php?id=start
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 25 Aug 2008 06:33:00 +0000 |
parents | 3202e4826c57 |
children | 6fc50bdd88c0 |
comparison
equal
deleted
inserted
replaced
2709:fd3f0f1147e7 | 2710:44e49d3fa6cf |
---|---|
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 |
31 //#include "SDL_gdirender.h" | 31 XDevice **SDL_XDevices; |
32 int SDL_NumOfXDevices; | |
33 XEventClass SDL_XEvents[256]; | |
34 int SDL_NumOfXEvents; | |
35 | |
36 int motion, button_pressed, button_released; /* the definitions of the mice events */ | |
37 int proximity_in, proximity_out; | |
32 | 38 |
33 /* Initialization/Query functions */ | 39 /* Initialization/Query functions */ |
34 static int X11_VideoInit(_THIS); | 40 static int X11_VideoInit(_THIS); |
35 static void X11_VideoQuit(_THIS); | 41 static void X11_VideoQuit(_THIS); |
36 | 42 |
95 | 101 |
96 static void | 102 static void |
97 X11_DeleteDevice(SDL_VideoDevice * device) | 103 X11_DeleteDevice(SDL_VideoDevice * device) |
98 { | 104 { |
99 SDL_VideoData *data = (SDL_VideoData *) device->driverdata; | 105 SDL_VideoData *data = (SDL_VideoData *) device->driverdata; |
100 | |
101 if (data->display) { | 106 if (data->display) { |
102 XCloseDisplay(data->display); | 107 XCloseDisplay(data->display); |
103 } | 108 } |
104 SDL_free(data->windowlist); | 109 SDL_free(data->windowlist); |
105 SDL_free(device->driverdata); | 110 SDL_free(device->driverdata); |
210 | 215 |
211 | 216 |
212 int | 217 int |
213 X11_VideoInit(_THIS) | 218 X11_VideoInit(_THIS) |
214 { | 219 { |
220 int i, index = 0, event_code; | |
221 XEventClass xEvent; | |
215 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; | 222 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
216 | 223 |
217 /* Get the window class name, usually the name of the application */ | 224 /* Get the window class name, usually the name of the application */ |
218 data->classname = get_classname(); | 225 data->classname = get_classname(); |
219 | 226 |
239 if (X11_InitKeyboard(_this) != 0) { | 246 if (X11_InitKeyboard(_this) != 0) { |
240 return -1; | 247 return -1; |
241 } | 248 } |
242 X11_InitMouse(_this); | 249 X11_InitMouse(_this); |
243 | 250 |
251 /* we're generating the table of events that should be recognized */ | |
252 for (i = 0; i < SDL_NumOfXDevices; ++i) { | |
253 /* button events */ | |
254 DeviceButtonPress(SDL_XDevices[i], event_code, xEvent); | |
255 if (xEvent) { | |
256 SDL_XEvents[index++] = xEvent; | |
257 button_pressed = event_code; | |
258 } | |
259 DeviceButtonRelease(SDL_XDevices[i], event_code, xEvent); | |
260 if (xEvent) { | |
261 SDL_XEvents[index++] = xEvent; | |
262 button_released = event_code; | |
263 } | |
264 | |
265 /* proximity events */ | |
266 ProximityIn(SDL_XDevices[i], event_code, xEvent); | |
267 if (xEvent) { | |
268 SDL_XEvents[index++] = xEvent; | |
269 proximity_in = event_code; | |
270 } | |
271 ProximityOut(SDL_XDevices[i], event_code, xEvent); | |
272 if (xEvent) { | |
273 SDL_XEvents[index++] = xEvent; | |
274 proximity_out = event_code; | |
275 } | |
276 | |
277 /* motion events */ | |
278 DeviceMotionNotify(SDL_XDevices[i], event_code, xEvent); | |
279 if (xEvent) { | |
280 SDL_XEvents[index++] = xEvent; | |
281 motion = event_code; | |
282 } | |
283 | |
284 } | |
285 SDL_NumOfXEvents = index; | |
286 | |
244 return 0; | 287 return 0; |
245 } | 288 } |
246 | 289 |
247 void | 290 void |
248 X11_VideoQuit(_THIS) | 291 X11_VideoQuit(_THIS) |
261 data->dpms_enabled); | 304 data->dpms_enabled); |
262 | 305 |
263 X11_QuitModes(_this); | 306 X11_QuitModes(_this); |
264 X11_QuitKeyboard(_this); | 307 X11_QuitKeyboard(_this); |
265 X11_QuitMouse(_this); | 308 X11_QuitMouse(_this); |
309 free(SDL_XDevices); | |
266 } | 310 } |
267 | 311 |
268 /* vim: set ts=4 sw=4 expandtab: */ | 312 /* vim: set ts=4 sw=4 expandtab: */ |