Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed mouse events with --disable-video-x11-xinput
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 5, 2009
1 parent 9277ec1 commit 8a5ea62
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -281,14 +281,14 @@ X11_DispatchEvent(_THIS)
break;

default:{
#if SDL_VIDEO_DRIVER_X11_XINPUT
for (i = 0; i < SDL_GetNumMice(); ++i) {
SDL_Mouse *mouse;
#if SDL_VIDEO_DRIVER_X11_XINPUT
X11_MouseData *data;
#endif

mouse = SDL_GetMouse(i);
data = (X11_MouseData *) mouse->driverdata;
if (!data) {
if (!mouse->driverdata) {
switch (xevent.type) {
case MotionNotify:
#ifdef DEBUG_MOTION
Expand All @@ -312,7 +312,9 @@ X11_DispatchEvent(_THIS)
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 *) & xevent;
#ifdef DEBUG_MOTION
Expand All @@ -322,14 +324,14 @@ X11_DispatchEvent(_THIS)
move->axis_data[2]);
return;
}
if (xevent.type == data->button_pressed) { /* ButtonPress */
if (xevent.type == data->button_pressed) {
XDeviceButtonPressedEvent *pressed =
(XDeviceButtonPressedEvent *) & xevent;
SDL_SendMouseButton(pressed->deviceid, SDL_PRESSED,
pressed->button);
return;
}
if (xevent.type == data->button_released) { /* ButtonRelease */
if (xevent.type == data->button_released) {
XDeviceButtonReleasedEvent *released =
(XDeviceButtonReleasedEvent *) & xevent;
SDL_SendMouseButton(released->deviceid, SDL_RELEASED,
Expand All @@ -350,8 +352,8 @@ X11_DispatchEvent(_THIS)
proximity->y, SDL_PROXIMITYOUT);
return;
}
}
#endif
}
#ifdef DEBUG_XEVENTS
printf("Unhandled event %d\n", xevent.type);
#endif
Expand Down

0 comments on commit 8a5ea62

Please sign in to comment.