Commit d1033aea authored by Sam Lantinga's avatar Sam Lantinga

Fixed mouse events with --disable-video-x11-xinput

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403465
parent b1aa228b
...@@ -281,14 +281,14 @@ X11_DispatchEvent(_THIS) ...@@ -281,14 +281,14 @@ X11_DispatchEvent(_THIS)
break; break;
default:{ default:{
#if SDL_VIDEO_DRIVER_X11_XINPUT
for (i = 0; i < SDL_GetNumMice(); ++i) { for (i = 0; i < SDL_GetNumMice(); ++i) {
SDL_Mouse *mouse; SDL_Mouse *mouse;
#if SDL_VIDEO_DRIVER_X11_XINPUT
X11_MouseData *data; X11_MouseData *data;
#endif
mouse = SDL_GetMouse(i); mouse = SDL_GetMouse(i);
data = (X11_MouseData *) mouse->driverdata; if (!mouse->driverdata) {
if (!data) {
switch (xevent.type) { switch (xevent.type) {
case MotionNotify: case MotionNotify:
#ifdef DEBUG_MOTION #ifdef DEBUG_MOTION
...@@ -312,7 +312,9 @@ X11_DispatchEvent(_THIS) ...@@ -312,7 +312,9 @@ X11_DispatchEvent(_THIS)
continue; continue;
} }
if (xevent.type == data->motion) { /* MotionNotify */ #if SDL_VIDEO_DRIVER_X11_XINPUT
data = (X11_MouseData *) mouse->driverdata;
if (xevent.type == data->motion) {
XDeviceMotionEvent *move = XDeviceMotionEvent *move =
(XDeviceMotionEvent *) & xevent; (XDeviceMotionEvent *) & xevent;
#ifdef DEBUG_MOTION #ifdef DEBUG_MOTION
...@@ -322,14 +324,14 @@ X11_DispatchEvent(_THIS) ...@@ -322,14 +324,14 @@ X11_DispatchEvent(_THIS)
move->axis_data[2]); move->axis_data[2]);
return; return;
} }
if (xevent.type == data->button_pressed) { /* ButtonPress */ if (xevent.type == data->button_pressed) {
XDeviceButtonPressedEvent *pressed = XDeviceButtonPressedEvent *pressed =
(XDeviceButtonPressedEvent *) & xevent; (XDeviceButtonPressedEvent *) & xevent;
SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED, SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
pressed->button); pressed->button);
return; return;
} }
if (xevent.type == data->button_released) { /* ButtonRelease */ if (xevent.type == data->button_released) {
XDeviceButtonReleasedEvent *released = XDeviceButtonReleasedEvent *released =
(XDeviceButtonReleasedEvent *) & xevent; (XDeviceButtonReleasedEvent *) & xevent;
SDL_SendMouseButton(released->deviceid, SDL_RELEASED, SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
...@@ -350,8 +352,8 @@ X11_DispatchEvent(_THIS) ...@@ -350,8 +352,8 @@ X11_DispatchEvent(_THIS)
proximity->y, SDL_PROXIMITYOUT); proximity->y, SDL_PROXIMITYOUT);
return; return;
} }
}
#endif #endif
}
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
printf("Unhandled event %d\n", xevent.type); printf("Unhandled event %d\n", xevent.type);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment