comparison src/video/x11/SDL_x11events.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
comparison
equal deleted inserted replaced
3771:8cc36a399a12 3772:9087a84cba51
27 27
28 #include "SDL_syswm.h" 28 #include "SDL_syswm.h"
29 #include "SDL_x11video.h" 29 #include "SDL_x11video.h"
30 #include "../../events/SDL_events_c.h" 30 #include "../../events/SDL_events_c.h"
31 31
32 //XEventClass *SDL_XEvents; 32 extern int motion;/*the motion event id defined by an XInput function*/
33 //int SDL_numOfEvents; 33 extern int button_pressed;/*the button_pressed event id defined by an XInput function*/
34 34 extern int button_released;/*the button_released event id defined by an XInput function*/
35 extern int motion; 35 extern int proximity_in;/*the proximity in event defined by an XInput function*/
36 extern int button_pressed; 36 extern int proximity_out;/*the proximity out event defined by an XInput function*/
37 extern int button_released;
38 extern int proximity_in;
39 extern int proximity_out;
40 extern int x_max,y_max;
41
42 37
43 static void 38 static void
44 X11_DispatchEvent(_THIS) 39 X11_DispatchEvent(_THIS)
45 { 40 {
46 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 41 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata;
47 SDL_WindowData *data; 42 SDL_WindowData *data;
48 XEvent xevent; 43 XEvent xevent;
49 int i,z; 44 int i,z;
50 //extern int motion;
51 //extern int button_pressed;
52 //extern int button_released;
53 45
54 SDL_zero(xevent); /* valgrind fix. --ryan. */ 46 SDL_zero(xevent); /* valgrind fix. --ryan. */
55 XNextEvent(videodata->display, &xevent); 47 XNextEvent(videodata->display, &xevent);
56 48
57 /* filter events catchs XIM events and sends them to the correct 49 /* filter events catchs XIM events and sends them to the correct
65 } 57 }
66 58
67 /* Send a SDL_SYSWMEVENT if the application wants them */ 59 /* Send a SDL_SYSWMEVENT if the application wants them */
68 if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) { 60 if (SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE) {
69 SDL_SysWMmsg wmmsg; 61 SDL_SysWMmsg wmmsg;
70
71 SDL_VERSION(&wmmsg.version); 62 SDL_VERSION(&wmmsg.version);
72 wmmsg.subsystem = SDL_SYSWM_X11; 63 wmmsg.subsystem = SDL_SYSWM_X11;
73 wmmsg.event.xevent = xevent; 64 wmmsg.event.xevent = xevent;
74 SDL_SendSysWMEvent(&wmmsg); 65 SDL_SendSysWMEvent(&wmmsg);
75 } 66 }
125 #endif 116 #endif
126 if ((xevent.xcrossing.mode != NotifyGrab) && 117 if ((xevent.xcrossing.mode != NotifyGrab) &&
127 (xevent.xcrossing.mode != NotifyUngrab) && 118 (xevent.xcrossing.mode != NotifyUngrab) &&
128 (xevent.xcrossing.detail != NotifyInferior)) { 119 (xevent.xcrossing.detail != NotifyInferior)) {
129 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; 120 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent;
130 //SDL_SendMouseMotion(move->deviceid, 0,
131 // move->x, move->y,move->axis_data[2]);
132 SDL_SetMouseFocus(move->deviceid, 0); 121 SDL_SetMouseFocus(move->deviceid, 0);
133 } 122 }
134 } 123 }
135 break; 124 break;
136 125
298 #ifdef DEBUG_MOTION 287 #ifdef DEBUG_MOTION
299 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); 288 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
300 #endif 289 #endif
301 XWindowAttributes attrib; 290 XWindowAttributes attrib;
302 XGetWindowAttributes(videodata->display, ((XAnyEvent*)&xevent)->window, &attrib); 291 XGetWindowAttributes(videodata->display, ((XAnyEvent*)&xevent)->window, &attrib);
303 /*x_max=attrib.width;
304 y_max=attrib.height;*/
305 SDL_UpdateCoordinates(attrib.width, attrib.height); 292 SDL_UpdateCoordinates(attrib.width, attrib.height);
306 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; 293 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent;
307 SDL_SendMouseMotion(move->deviceid, 0, move->x, 294 SDL_SendMouseMotion(move->deviceid, 0, move->x,
308 move->y,move->axis_data[2]); 295 move->y,move->axis_data[2]);
309 } 296 }