comparison src/video/x11/SDL_x11events.c @ 2794:f7872b7a8732

Fixed mouse coordinate range on Mac OS X
author Sam Lantinga <slouken@libsdl.org>
date Thu, 27 Nov 2008 21:53:18 +0000
parents 6fc50bdd88c0
children 99210400e8b9
comparison
equal deleted inserted replaced
2793:b14f672b2857 2794:f7872b7a8732
276 } 276 }
277 break; 277 break;
278 278
279 default:{ 279 default:{
280 if (xevent.type == motion) { /* MotionNotify */ 280 if (xevent.type == motion) { /* MotionNotify */
281 XDeviceMotionEvent *move = (XDeviceMotionEvent *) & xevent;
281 #ifdef DEBUG_MOTION 282 #ifdef DEBUG_MOTION
282 printf("X11 motion: %d,%d\n", xevent.xmotion.x, 283 printf("X11 motion: %d,%d\n", move->x, move->y);
283 xevent.xmotion.y); 284 #endif
284 #endif
285 XWindowAttributes attrib;
286 XGetWindowAttributes(videodata->display,
287 ((XAnyEvent *) & xevent)->window,
288 &attrib);
289 SDL_UpdateCoordinates(attrib.width, attrib.height);
290 XDeviceMotionEvent *move = (XDeviceMotionEvent *) & xevent;
291 SDL_SendMouseMotion(move->deviceid, 0, move->x, 285 SDL_SendMouseMotion(move->deviceid, 0, move->x,
292 move->y, move->axis_data[2]); 286 move->y, move->axis_data[2]);
293 } else if (xevent.type == button_pressed) { /* ButtonPress */ 287 } else if (xevent.type == button_pressed) { /* ButtonPress */
294 XDeviceButtonPressedEvent *pressed = 288 XDeviceButtonPressedEvent *pressed =
295 (XDeviceButtonPressedEvent *) & xevent; 289 (XDeviceButtonPressedEvent *) & xevent;