dix: Don't set core events in SetMaskForEvent.
Rather, modify the two callers to call separately for the two different. events. Unexport SetMaskForEvent too. And while we're at it, get rid of the MotionFilter macro, because it's one half confusing and one half pointless. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
58f3127919
commit
772e0f9159
|
@ -83,8 +83,6 @@ SOFTWARE.
|
|||
Mod3Mask | Mod4Mask | Mod5Mask )
|
||||
#define AllButtonsMask ( \
|
||||
Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask )
|
||||
#define Motion_Filter(class) (DevicePointerMotionMask | \
|
||||
(class)->state | (class)->motionMask)
|
||||
|
||||
Bool ShouldFreeInputMasks(WindowPtr /* pWin */ ,
|
||||
Bool /* ignoreSelectedEvents */
|
||||
|
@ -832,6 +830,7 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
|
|||
device->valuator->motionHintWindow = NullWindow;
|
||||
*kptr &= ~bit;
|
||||
} else if (xE->u.u.type == DeviceButtonPress) {
|
||||
Mask mask;
|
||||
if (!b)
|
||||
return DONT_PROCESS;
|
||||
|
||||
|
@ -847,8 +846,15 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
|
|||
b->motionMask = DeviceButtonMotionMask;
|
||||
if (b->map[key] <= 5)
|
||||
b->state |= (Button1Mask >> 1) << b->map[key];
|
||||
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
||||
|
||||
/* Add state and motionMask to the filter for this event */
|
||||
mask = DevicePointerMotionMask | b->state | b->motionMask;
|
||||
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
|
||||
mask = PointerMotionMask | b->state | b->motionMask;
|
||||
SetMaskForEvent(device->id, mask, MotionNotify);
|
||||
} else if (xE->u.u.type == DeviceButtonRelease) {
|
||||
Mask mask;
|
||||
|
||||
if (!b)
|
||||
return DONT_PROCESS;
|
||||
|
||||
|
@ -879,7 +885,12 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
|
|||
b->motionMask = 0;
|
||||
if (b->map[key] <= 5)
|
||||
b->state &= ~((Button1Mask >> 1) << b->map[key]);
|
||||
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
|
||||
|
||||
/* Add state and motionMask to the filter for this event */
|
||||
mask = DevicePointerMotionMask | b->state | b->motionMask;
|
||||
SetMaskForEvent(device->id, mask, DeviceMotionNotify);
|
||||
mask = PointerMotionMask | b->state | b->motionMask;
|
||||
SetMaskForEvent(device->id, mask, MotionNotify);
|
||||
} else if (xE->u.u.type == ProximityIn)
|
||||
device->valuator->mode &= ~OutOfProximity;
|
||||
else if (xE->u.u.type == ProximityOut)
|
||||
|
|
31
dix/events.c
31
dix/events.c
|
@ -190,13 +190,6 @@ typedef const char *string;
|
|||
* See DeliverEventsToWindow().
|
||||
*/
|
||||
#define ImplicitGrabMask (1 << 7)
|
||||
/*
|
||||
* The following relies on the fact that the Button<n>MotionMasks are equal
|
||||
* to the corresponding Button<n>Masks from the current modifier/button state.
|
||||
*/
|
||||
#define Motion_Filter(class) (PointerMotionMask | \
|
||||
(class)->state | (class)->motionMask)
|
||||
|
||||
|
||||
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||
|
||||
|
@ -571,20 +564,26 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
|
|||
|
||||
#endif /* PANORAMIX */
|
||||
|
||||
/**
|
||||
* Modifies the filter for the given protocol event type to the given masks.
|
||||
*
|
||||
* There's only two callers: UpdateDeviceState() and XI's SetMaskForExtEvent().
|
||||
* The latter initialises masks for the matching XI events, it's a once-off
|
||||
* setting.
|
||||
* UDS however changes the mask for MotionNotify and DeviceMotionNotify each
|
||||
* time a button is pressed to include the matching ButtonXMotion mask in the
|
||||
* filter.
|
||||
*
|
||||
* @param[in] deviceid The device to modify the filter for.
|
||||
* @param[in] mask The new filter mask.
|
||||
* @param[in] event Protocol event type.
|
||||
*/
|
||||
void
|
||||
SetMaskForEvent(int deviceid, Mask mask, int event)
|
||||
{
|
||||
int coretype;
|
||||
if (deviceid < 0 || deviceid > MAXDEVICES)
|
||||
FatalError("SetMaskForEvent: bogus device id");
|
||||
if ((event < LASTEvent) || (event >= 128))
|
||||
FatalError("SetMaskForEvent: bogus event number");
|
||||
filters[deviceid][event] = mask;
|
||||
|
||||
/* Need to change the mask for the core events too */
|
||||
coretype = XItoCoreType(event);
|
||||
if (coretype)
|
||||
filters[deviceid][coretype] = mask;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -4618,6 +4617,8 @@ InitEvents(void)
|
|||
inputInfo.keyboard = (DeviceIntPtr)NULL;
|
||||
inputInfo.pointer = (DeviceIntPtr)NULL;
|
||||
lastEventMask = OwnerGrabButtonMask;
|
||||
/* The mask for pointer motion events may have changed in the last server
|
||||
* generation. See comment above definition of filters. */
|
||||
filters[0][PointerMotionMask] = MotionNotify;
|
||||
for (i = 1; i < MAXDEVICES; i++)
|
||||
{
|
||||
|
|
|
@ -304,7 +304,7 @@ extern _X_EXPORT void SetVendorString(char *string);
|
|||
|
||||
/* events.c */
|
||||
|
||||
extern _X_EXPORT void SetMaskForEvent(
|
||||
extern void SetMaskForEvent(
|
||||
int /* deviceid */,
|
||||
Mask /* mask */,
|
||||
int /* event */);
|
||||
|
|
Loading…
Reference in New Issue
Block a user