Count the number of logically down buttons in buttonsDown
This fixes the following bug. Assuming your window manager grabs Alt+Button1 to move windows, map Button3 to 0 via XSetPointerMapping, then press the physical button 3 (this shouldn't have any effect), press Alt and then button 1. The press event is delivered to the application instead of firing the grab. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
6f065a26db
commit
f7f85f6965
|
@ -946,10 +946,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
|
||||||
*kptr |= bit;
|
*kptr |= bit;
|
||||||
if (device->valuator)
|
if (device->valuator)
|
||||||
device->valuator->motionHintWindow = NullWindow;
|
device->valuator->motionHintWindow = NullWindow;
|
||||||
b->buttonsDown++;
|
|
||||||
b->motionMask = DeviceButtonMotionMask;
|
|
||||||
if (!b->map[key])
|
if (!b->map[key])
|
||||||
return DONT_PROCESS;
|
return DONT_PROCESS;
|
||||||
|
b->buttonsDown++;
|
||||||
|
b->motionMask = DeviceButtonMotionMask;
|
||||||
if (b->map[key] <= 5)
|
if (b->map[key] <= 5)
|
||||||
b->state |= (Button1Mask >> 1) << b->map[key];
|
b->state |= (Button1Mask >> 1) << b->map[key];
|
||||||
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
||||||
|
@ -978,10 +978,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
|
||||||
*kptr &= ~bit;
|
*kptr &= ~bit;
|
||||||
if (device->valuator)
|
if (device->valuator)
|
||||||
device->valuator->motionHintWindow = NullWindow;
|
device->valuator->motionHintWindow = NullWindow;
|
||||||
if (b->buttonsDown >= 1 && !--b->buttonsDown)
|
|
||||||
b->motionMask = 0;
|
|
||||||
if (!b->map[key])
|
if (!b->map[key])
|
||||||
return DONT_PROCESS;
|
return DONT_PROCESS;
|
||||||
|
if (b->buttonsDown >= 1 && !--b->buttonsDown)
|
||||||
|
b->motionMask = 0;
|
||||||
if (b->map[key] <= 5)
|
if (b->map[key] <= 5)
|
||||||
b->state &= ~((Button1Mask >> 1) << b->map[key]);
|
b->state &= ~((Button1Mask >> 1) << b->map[key]);
|
||||||
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
||||||
|
|
|
@ -185,7 +185,11 @@ typedef struct _ValuatorClassRec {
|
||||||
|
|
||||||
typedef struct _ButtonClassRec {
|
typedef struct _ButtonClassRec {
|
||||||
CARD8 numButtons;
|
CARD8 numButtons;
|
||||||
CARD8 buttonsDown; /* number of buttons currently down */
|
CARD8 buttonsDown; /* number of buttons currently down
|
||||||
|
This counts logical buttons, not
|
||||||
|
physical ones, i.e if some buttons
|
||||||
|
are mapped to 0, they're not counted
|
||||||
|
here */
|
||||||
unsigned short state;
|
unsigned short state;
|
||||||
Mask motionMask;
|
Mask motionMask;
|
||||||
CARD8 down[DOWN_LENGTH];
|
CARD8 down[DOWN_LENGTH];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user