summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-02-12 13:38:34 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-02-16 13:28:17 +1000
commit772e0f9159ca3ab8fb4e03ed6feee3cc93697724 (patch)
tree43721047867a1f063cacecf80b927a6318021abc
parent58f3127919ba5fcb3bb467b6913c28ee1127c82b (diff)
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>
-rw-r--r--Xi/exevents.c19
-rw-r--r--dix/events.c31
-rw-r--r--include/dix.h2
3 files changed, 32 insertions, 20 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index ad3d4290b..af98bac04 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -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)
diff --git a/dix/events.c b/dix/events.c
index 598dc7514..ae566c539 100644
--- a/dix/events.c
+++ b/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++)
{
diff --git a/include/dix.h b/include/dix.h
index 8d6b9ff44..204dcf296 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -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 */);