mirror of https://github.com/encounter/SDL.git
Added support for touchpads in the Linux evdev code (thanks Francisco!)
This commit is contained in:
parent
16aeb8d0f5
commit
373216ae5b
|
@ -218,8 +218,11 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl
|
||||||
|
|
||||||
switch(udev_event) {
|
switch(udev_event) {
|
||||||
case SDL_UDEV_DEVICEADDED:
|
case SDL_UDEV_DEVICEADDED:
|
||||||
if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD |
|
if (udev_class & SDL_UDEV_DEVICE_TOUCHPAD) {
|
||||||
SDL_UDEV_DEVICE_TOUCHSCREEN)))
|
udev_class |= SDL_UDEV_DEVICE_TOUCHSCREEN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_TOUCHSCREEN)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK))
|
if ((udev_class & SDL_UDEV_DEVICE_JOYSTICK))
|
||||||
|
|
|
@ -78,7 +78,7 @@ SDL_EVDEV_GuessDeviceClass(unsigned long bitmask_ev[NBITS(EV_MAX)],
|
||||||
if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
if (test_bit(BTN_STYLUS, bitmask_key) || test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||||
; /* ID_INPUT_TABLET */
|
; /* ID_INPUT_TABLET */
|
||||||
} else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
} else if (test_bit(BTN_TOOL_FINGER, bitmask_key) && !test_bit(BTN_TOOL_PEN, bitmask_key)) {
|
||||||
; /* ID_INPUT_TOUCHPAD */
|
devclass |= SDL_UDEV_DEVICE_TOUCHPAD; /* ID_INPUT_TOUCHPAD */
|
||||||
} else if (test_bit(BTN_MOUSE, bitmask_key)) {
|
} else if (test_bit(BTN_MOUSE, bitmask_key)) {
|
||||||
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
|
||||||
} else if (test_bit(BTN_TOUCH, bitmask_key)) {
|
} else if (test_bit(BTN_TOUCH, bitmask_key)) {
|
||||||
|
|
|
@ -38,7 +38,8 @@ typedef enum
|
||||||
SDL_UDEV_DEVICE_JOYSTICK = 0x0004,
|
SDL_UDEV_DEVICE_JOYSTICK = 0x0004,
|
||||||
SDL_UDEV_DEVICE_SOUND = 0x0008,
|
SDL_UDEV_DEVICE_SOUND = 0x0008,
|
||||||
SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010,
|
SDL_UDEV_DEVICE_TOUCHSCREEN = 0x0010,
|
||||||
SDL_UDEV_DEVICE_ACCELEROMETER = 0x0020
|
SDL_UDEV_DEVICE_ACCELEROMETER = 0x0020,
|
||||||
|
SDL_UDEV_DEVICE_TOUCHPAD = 0x0040
|
||||||
} SDL_UDEV_deviceclass;
|
} SDL_UDEV_deviceclass;
|
||||||
|
|
||||||
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
||||||
|
|
Loading…
Reference in New Issue