# HG changeset patch # User Szymon Wilczek # Date 1213896270 0 # Node ID e0c95ad1ba877d15352ce156054bfac76691fee6 # Parent 64f346a83ed3ed51e7a41e6213b5340bb0d4480b Major bug fixes diff -r 64f346a83ed3 -r e0c95ad1ba87 src/video/x11/SDL_x11events.c --- a/src/video/x11/SDL_x11events.c Fri Jun 06 15:23:29 2008 +0000 +++ b/src/video/x11/SDL_x11events.c Thu Jun 19 17:24:30 2008 +0000 @@ -32,6 +32,10 @@ //XEventClass *SDL_XEvents; //int SDL_numOfEvents; +extern int motion; +extern int button_pressed; +extern int button_released; + static void X11_DispatchEvent(_THIS) { @@ -39,6 +43,9 @@ SDL_WindowData *data; XEvent xevent; int i,z; + //extern int motion; + //extern int button_pressed; + //extern int button_released; SDL_zero(xevent); /* valgrind fix. --ryan. */ XNextEvent(videodata->display, &xevent); @@ -171,34 +178,6 @@ } break; - /* Mouse motion? */ - case 103:{ //MotionNotify -#ifdef DEBUG_MOTION - printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); -#endif - XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; - SDL_SendMouseMotion(move->deviceid, 0, move->x, - move->y,move->axis_data[2]); - } - break; - /*case MotionNotify:{ - - /* Mouse button press? */ - case 101:{//ButtonPress - XDeviceButtonPressedEvent* pressed=(XDeviceButtonPressedEvent*)&xevent; - SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, - pressed->button); - } - break; - - /* Mouse button release? */ - case 102:{//ButtonRelease - XDeviceButtonReleasedEvent* released=(XDeviceButtonReleasedEvent*)&xevent; - SDL_SendMouseButton(released->deviceid, SDL_RELEASED, - released->button); - } - break; - /* Key press? */ case KeyPress:{ KeyCode keycode = xevent.xkey.keycode; @@ -310,14 +289,44 @@ break; default:{ + if(xevent.type==motion)//MotionNotify + { +#ifdef DEBUG_MOTION + printf("X11 motion: %d,%d\n", xevent.xmotion.x, xevent.xmotion.y); +#endif + XDeviceMotionEvent* move=(XDeviceMotionEvent*)&xevent; + SDL_SendMouseMotion(move->deviceid, 0, move->x, + move->y,move->axis_data[2]); + } + /* + + Mouse button press? */ + else if(xevent.type==button_pressed)//ButtonPress + { + XDeviceButtonPressedEvent* pressed=(XDeviceButtonPressedEvent*)&xevent; + SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, + pressed->button); + } + + /* Mouse button release? */ + else if(xevent.type==button_released)//ButtonRelease + { + XDeviceButtonReleasedEvent* released=(XDeviceButtonReleasedEvent*)&xevent; + SDL_SendMouseButton(released->deviceid, SDL_RELEASED, + released->button); + } + else + { #ifdef DEBUG_XEVENTS - printf("Unhandled event %d\n", xevent.type); + printf("Unhandled event %d\n", xevent.type); #endif + } } break; } } + /* Ack! XPending() actually performs a blocking read if no events available */ int X11_Pending(Display * display) diff -r 64f346a83ed3 -r e0c95ad1ba87 src/video/x11/SDL_x11mouse.c --- a/src/video/x11/SDL_x11mouse.c Fri Jun 06 15:23:29 2008 +0000 +++ b/src/video/x11/SDL_x11mouse.c Thu Jun 19 17:24:30 2008 +0000 @@ -37,7 +37,7 @@ SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; DevList=XListInputDevices(data->display, &numOfDevices); - + SDL_XDevices=(XDevice**) SDL_malloc(sizeof(XDevice)); for(i=0;i