Module: wine Branch: master Commit: 64c27d62b528a72924499c7c587c0780882ccff5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=64c27d62b528a72924499c7c58...
Author: Carlos Garnacho carlosg@gnome.org Date: Fri Nov 18 12:43:18 2016 +0100
winex11: Always use the client pointer for raw events.
Use XI2's client pointer, it will be the master pointer affected by X core calls, and even if it doesn't currently have relative X/Y capabilities, it will gain those as soon as a slave device with such capabilities is used.
Signed-off-by: Carlos Garnacho carlosg@gnome.org Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/winex11.drv/mouse.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index a120fae..186899f 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -132,6 +132,7 @@ static Cursor create_cursor( HANDLE handle ); static BOOL xinput2_available; static BOOL broken_rawevents; #define MAKE_FUNCPTR(f) static typeof(f) * p##f +MAKE_FUNCPTR(XIGetClientPointer); MAKE_FUNCPTR(XIFreeDeviceInfo); MAKE_FUNCPTR(XIQueryDevice); MAKE_FUNCPTR(XIQueryVersion); @@ -255,7 +256,7 @@ static void enable_xinput2(void) XIEventMask mask; XIDeviceInfo *devices; unsigned char mask_bits[XIMaskLen(XI_LASTEVENT)]; - int i, j, count; + int i;
if (!xinput2_available) return;
@@ -272,29 +273,8 @@ static void enable_xinput2(void) if (data->xi2_state == xi_unavailable) return;
if (data->xi2_devices) pXIFreeDeviceInfo( data->xi2_devices ); + if (!pXIGetClientPointer( data->display, None, &data->xi2_core_pointer )) return; data->xi2_devices = devices = pXIQueryDevice( data->display, XIAllDevices, &data->xi2_device_count ); - for (i = 0; i < data->xi2_device_count; ++i) - { - if (devices[i].use != XIMasterPointer) continue; - for (j = count = 0; j < devices[i].num_classes; j++) - { - XIValuatorClassInfo *class = (XIValuatorClassInfo *)devices[i].classes[j]; - - if (devices[i].classes[j]->type != XIValuatorClass) continue; - TRACE( "Device %u (%s) num %u %f,%f res %u mode %u label %s\n", - devices[i].deviceid, debugstr_a(devices[i].name), - class->number, class->min, class->max, class->resolution, class->mode, - XGetAtomName( data->display, class->label )); - if (class->label == x11drv_atom( Rel_X ) || class->label == x11drv_atom( Rel_Y )) count++; - /* workaround for drivers that don't provide labels */ - if (!class->label && class->number <= 1 && class->mode == XIModeRelative) count++; - } - if (count < 2) continue; - TRACE( "Using %u (%s) as core pointer\n", - devices[i].deviceid, debugstr_a(devices[i].name) ); - data->xi2_core_pointer = devices[i].deviceid; - break; - }
mask.mask = mask_bits; mask.mask_len = sizeof(mask_bits); @@ -1729,6 +1709,7 @@ void X11DRV_XInput2_Init(void) return; \ }
+ LOAD_FUNCPTR(XIGetClientPointer); LOAD_FUNCPTR(XIFreeDeviceInfo); LOAD_FUNCPTR(XIQueryDevice); LOAD_FUNCPTR(XIQueryVersion);