Mercurial > sdl-ios-xcode
diff src/video/x11/SDL_x11mouse.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 | 1e242954330b |
children | 0deb3e94c251 |
line wrap: on
line diff
--- a/src/video/x11/SDL_x11mouse.c Sun Jan 04 17:30:00 2009 +0000 +++ b/src/video/x11/SDL_x11mouse.c Sun Jan 04 18:29:20 2009 +0000 @@ -50,19 +50,14 @@ int event_code; XEventClass xEvent; #endif - - SDL_zero(mouse); - SDL_AddMouse(&mouse, "CorePointer", 0, 0, 1); + int num_mice = 0; #if SDL_VIDEO_DRIVER_X11_XINPUT - if (!SDL_X11_HAVE_XINPUT) { - /* should have dynamically loaded, but wasn't available. */ - return; - } - /* we're getting the list of input devices */ n = 0; - DevList = XListInputDevices(display, &n); + if (SDL_X11_HAVE_XINPUT) { + DevList = XListInputDevices(display, &n); + } /* we're aquiring valuators: mice, tablets, etc. */ for (i = 0; i < n; ++i) { @@ -127,6 +122,9 @@ } else { SDL_AddMouse(&mouse, DevList[i].name, 0, 0, 1); } + if (DevList[i].use == IsXExtensionPointer) { + ++num_mice; + } break; } /* if it's not class we're interested in, lets go further */ @@ -138,6 +136,11 @@ } XFreeDeviceList(DevList); #endif + + if (num_mice == 0) { + SDL_zero(mouse); + SDL_AddMouse(&mouse, "CorePointer", 0, 0, 1); + } } void