Mercurial > sdl-ios-xcode
comparison src/video/x11/SDL_x11events.c @ 3760:64f346a83ed3 gsoc2008_manymouse
http://wilku.ravenlord.ws/doku.php?id=documentation for information how things work. Currently implemented: detecting many pointing devices and pressure detection. Still a bug. Each program has to be comipled with a flag -lXi
author | Szymon Wilczek <kazeuser@gmail.com> |
---|---|
date | Fri, 06 Jun 2008 15:23:29 +0000 |
parents | 91e601d9df8b |
children | e0c95ad1ba87 |
comparison
equal
deleted
inserted
replaced
3759:064c178558b7 | 3760:64f346a83ed3 |
---|---|
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; | |
33 //int SDL_numOfEvents; | |
34 | |
32 static void | 35 static void |
33 X11_DispatchEvent(_THIS) | 36 X11_DispatchEvent(_THIS) |
34 { | 37 { |
35 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; | 38 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; |
36 SDL_WindowData *data; | 39 SDL_WindowData *data; |
37 XEvent xevent; | 40 XEvent xevent; |
38 int i; | 41 int i,z; |
39 | 42 |
40 SDL_zero(xevent); /* valgrind fix. --ryan. */ | 43 SDL_zero(xevent); /* valgrind fix. --ryan. */ |
41 XNextEvent(videodata->display, &xevent); | 44 XNextEvent(videodata->display, &xevent); |
42 | 45 |
43 /* filter events catchs XIM events and sends them to the correct | 46 /* filter events catchs XIM events and sends them to the correct |
89 if (xevent.xcrossing.mode == NotifyUngrab) | 92 if (xevent.xcrossing.mode == NotifyUngrab) |
90 printf("Mode: NotifyUngrab\n"); | 93 printf("Mode: NotifyUngrab\n"); |
91 #endif | 94 #endif |
92 if ((xevent.xcrossing.mode != NotifyGrab) && | 95 if ((xevent.xcrossing.mode != NotifyGrab) && |
93 (xevent.xcrossing.mode != NotifyUngrab)) { | 96 (xevent.xcrossing.mode != NotifyUngrab)) { |
94 SDL_SetMouseFocus(videodata->mouse, data->windowID); | 97 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; |
95 SDL_SendMouseMotion(videodata->mouse, 0, xevent.xcrossing.x, | 98 SDL_SetMouseFocus(move->deviceid, data->windowID); |
96 xevent.xcrossing.y); | 99 SDL_SendMouseMotion(move->deviceid, 0, move->x, |
100 move->y,move->axis_data[2]); | |
97 } | 101 } |
98 } | 102 } |
99 break; | 103 break; |
100 | 104 |
101 /* Losing mouse coverage? */ | 105 /* Losing mouse coverage? */ |
109 printf("Mode: NotifyUngrab\n"); | 113 printf("Mode: NotifyUngrab\n"); |
110 #endif | 114 #endif |
111 if ((xevent.xcrossing.mode != NotifyGrab) && | 115 if ((xevent.xcrossing.mode != NotifyGrab) && |
112 (xevent.xcrossing.mode != NotifyUngrab) && | 116 (xevent.xcrossing.mode != NotifyUngrab) && |
113 (xevent.xcrossing.detail != NotifyInferior)) { | 117 (xevent.xcrossing.detail != NotifyInferior)) { |
114 SDL_SendMouseMotion(videodata->mouse, 0, | 118 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; |
115 xevent.xcrossing.x, xevent.xcrossing.y); | 119 SDL_SendMouseMotion(move->deviceid, 0, |
116 SDL_SetMouseFocus(videodata->mouse, 0); | 120 move->x, move->y,move->axis_data[2]); |
121 SDL_SetMouseFocus(move->deviceid, 0); | |
117 } | 122 } |
118 } | 123 } |
119 break; | 124 break; |
120 | 125 |
121 /* Gaining input focus? */ | 126 /* Gaining input focus? */ |
165 X11_UpdateKeymap(_this); | 170 X11_UpdateKeymap(_this); |
166 } | 171 } |
167 break; | 172 break; |
168 | 173 |
169 /* Mouse motion? */ | 174 /* Mouse motion? */ |
170 case MotionNotify:{ | 175 case 103:{ //MotionNotify |
171 #ifdef DEBUG_MOTION | 176 #ifdef DEBUG_MOTION |
172 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); | 177 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); |
173 #endif | 178 #endif |
174 SDL_SendMouseMotion(videodata->mouse, 0, xevent.xmotion.x, | 179 XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; |
175 xevent.xmotion.y); | 180 SDL_SendMouseMotion(move->deviceid, 0, move->x, |
176 } | 181 move->y,move->axis_data[2]); |
177 break; | 182 } |
183 break; | |
184 /*case MotionNotify:{ | |
178 | 185 |
179 /* Mouse button press? */ | 186 /* Mouse button press? */ |
180 case ButtonPress:{ | 187 case 101:{//ButtonPress |
181 SDL_SendMouseButton(videodata->mouse, SDL_PRESSED, | 188 XDeviceButtonPressedEvent* pressed=(XDeviceButtonPressedEvent*)&xevent; |
182 xevent.xbutton.button); | 189 SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, |
190 pressed->button); | |
183 } | 191 } |
184 break; | 192 break; |
185 | 193 |
186 /* Mouse button release? */ | 194 /* Mouse button release? */ |
187 case ButtonRelease:{ | 195 case 102:{//ButtonRelease |
188 SDL_SendMouseButton(videodata->mouse, SDL_RELEASED, | 196 XDeviceButtonReleasedEvent* released=(XDeviceButtonReleasedEvent*)&xevent; |
189 xevent.xbutton.button); | 197 SDL_SendMouseButton(released->deviceid, SDL_RELEASED, |
198 released->button); | |
190 } | 199 } |
191 break; | 200 break; |
192 | 201 |
193 /* Key press? */ | 202 /* Key press? */ |
194 case KeyPress:{ | 203 case KeyPress:{ |