comparison src/video/x11/SDL_x11events.c @ 2992:dbff5769d742

The core pointer is comprised of merging the inputs of all mice. If there are other mice, they should show up in the device list, and we want to report events from those devices instead of the core events. However, if XInput isn't supported or we can't find other mice in the device list, we'll add the core pointer and interpret normal mouse events.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 04 Jan 2009 18:29:20 +0000
parents 1e431c2631ee
children 2fad80c77c17
comparison
equal deleted inserted replaced
2991:f4d14219c2aa 2992:dbff5769d742
278 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, 0, 278 SDL_SendWindowEvent(data->windowID, SDL_WINDOWEVENT_EXPOSED, 0,
279 0); 279 0);
280 } 280 }
281 break; 281 break;
282 282
283 case MotionNotify:
284 #ifdef DEBUG_MOTION
285 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
286 #endif
287 SDL_SendMouseMotion(0, 0, xevent.xmotion.x, xevent.xmotion.y, 0);
288 break;
289
290 case ButtonPress:
291 SDL_SendMouseButton(0, SDL_PRESSED, xevent.xbutton.button);
292 break;
293
294 case ButtonRelease:
295 SDL_SendMouseButton(0, SDL_RELEASED, xevent.xbutton.button);
296 break;
297
298 default:{ 283 default:{
299 #if SDL_VIDEO_DRIVER_X11_XINPUT 284 #if SDL_VIDEO_DRIVER_X11_XINPUT
300 for (i = 0; i < SDL_GetNumMice(); ++i) { 285 for (i = 0; i < SDL_GetNumMice(); ++i) {
301 SDL_Mouse *mouse; 286 SDL_Mouse *mouse;
302 X11_MouseData *data; 287 X11_MouseData *data;
303 288
304 mouse = SDL_GetMouse(i); 289 mouse = SDL_GetMouse(i);
305 data = (X11_MouseData *) mouse->driverdata; 290 data = (X11_MouseData *) mouse->driverdata;
306 if (!data) { 291 if (!data) {
292 switch (xevent.type) {
293 case MotionNotify:
294 #ifdef DEBUG_MOTION
295 printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y);
296 #endif
297 SDL_SendMouseMotion(0, 0, xevent.xmotion.x, xevent.xmotion.y, 0);
298 break;
299
300 case ButtonPress:
301 SDL_SendMouseButton(0, SDL_PRESSED, xevent.xbutton.button);
302 break;
303
304 case ButtonRelease:
305 SDL_SendMouseButton(0, SDL_RELEASED, xevent.xbutton.button);
306 break;
307 }
307 continue; 308 continue;
308 } 309 }
309 310
310 if (xevent.type == data->motion) { /* MotionNotify */ 311 if (xevent.type == data->motion) { /* MotionNotify */
311 XDeviceMotionEvent *move = 312 XDeviceMotionEvent *move =