mirror of https://github.com/encounter/SDL.git
x11: Don't look up xinput2 devices unless we're in relative mode.
This commit is contained in:
parent
2dd7659884
commit
b599205d0c
|
@ -280,17 +280,22 @@ X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie)
|
||||||
case XI_RawMotion: {
|
case XI_RawMotion: {
|
||||||
const XIRawEvent *rawev = (const XIRawEvent*)cookie->data;
|
const XIRawEvent *rawev = (const XIRawEvent*)cookie->data;
|
||||||
SDL_Mouse *mouse = SDL_GetMouse();
|
SDL_Mouse *mouse = SDL_GetMouse();
|
||||||
SDL_XInput2DeviceInfo *devinfo = xinput2_get_device_info(videodata, rawev->deviceid);
|
SDL_XInput2DeviceInfo *devinfo;
|
||||||
double coords[2];
|
double coords[2];
|
||||||
double processed_coords[2];
|
double processed_coords[2];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
videodata->global_mouse_changed = SDL_TRUE;
|
videodata->global_mouse_changed = SDL_TRUE;
|
||||||
|
|
||||||
if (!devinfo || !mouse->relative_mode || mouse->relative_mode_warp) {
|
if (!mouse->relative_mode || mouse->relative_mode_warp) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
devinfo = xinput2_get_device_info(videodata, rawev->deviceid);
|
||||||
|
if (!devinfo) {
|
||||||
|
return 0; /* oh well. */
|
||||||
|
}
|
||||||
|
|
||||||
parse_valuators(rawev->raw_values,rawev->valuators.mask,
|
parse_valuators(rawev->raw_values,rawev->valuators.mask,
|
||||||
rawev->valuators.mask_len,coords,2);
|
rawev->valuators.mask_len,coords,2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue