xserver: Branch 'mpx' - 4 commits
Peter Hutterer
whot at kemper.freedesktop.org
Thu Dec 6 22:55:17 PST 2007
Xi/exevents.c | 4 -
Xi/extinit.c | 12 ++++-
dix/events.c | 123 ++++++++++++++++++++++++++------------------------------
dix/getevents.c | 14 +-----
dix/window.c | 6 --
include/dix.h | 1
6 files changed, 75 insertions(+), 85 deletions(-)
New commits:
commit 447cd5d411875b62eb1a501bf00e604225b74d26
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Tue Dec 4 19:09:37 2007 +1030
dix: update comments about inputInfo.pointer.
diff --git a/dix/events.c b/dix/events.c
index 046e4cd..340e2bc 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -237,24 +237,21 @@ static int DontPropagateRefCnts[DNPMCOUNT];
* inputInfo.pointer
* is the core pointer. Referred to as "virtual core pointer", "VCP",
* "core pointer" or inputInfo.pointer. There is exactly one core pointer,
- * but multiple devices may send core events. The VCP is only used if no
- * physical device is connected and does not have a visible cursor.
- * Before the integration of MPX, any core request would operate on the
- * VCP/VCK. Core events would always come from one of those two. Now both
- * are only fallback devices if no physical devices are available.
+ * but multiple devices may send core events. The VCP is the first master
+ * pointer device and cannot be deleted.
*
* inputInfo.keyboard
* is the core keyboard ("virtual core keyboard", "VCK", "core keyboard").
* See inputInfo.pointer.
*
* inputInfo.devices
- * linked list containing all devices BUT NOT INCLUDING VCK and VCP.
+ * linked list containing all devices including VCP and VCK.
*
* inputInfo.off_devices
* Devices that have not been initialized and are thus turned off.
*
* inputInfo.numDevices
- * Total number of devices (not counting VCP and VCK).
+ * Total number of devices.
*/
_X_EXPORT InputInfo inputInfo;
commit f44d7dcb5fefca3ddfd45e75d0bd0b47ec785e48
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Tue Dec 4 19:07:46 2007 +1030
dix: change the filters to be per-device.
If we have one global filter, one pointer may change the filter value and
affect another pointer.
Reproduceable effect:
blackbox and xterm, start dragging xterm then click anywhere with the other
pointer (attached to different masterd device!). The button release resets
the filter[Motion_Filter(button)] value, thus stopping dragging and no event
is sent to the client anymore.
Having the filters set per device gets around this.
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 8c8cdfd..f0d288f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -550,7 +550,7 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
return DONT_PROCESS;
if (b->map[key] <= 5)
b->state |= (Button1Mask >> 1) << b->map[key];
- SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
+ SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
} else if (xE->u.u.type == DeviceButtonRelease) {
if (!b)
return DONT_PROCESS;
@@ -567,7 +567,7 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
return DONT_PROCESS;
if (b->map[key] <= 5)
b->state &= ~((Button1Mask >> 1) << b->map[key]);
- SetMaskForEvent(Motion_Filter(b), DeviceMotionNotify);
+ SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
} else if (xE->u.u.type == ProximityIn)
device->valuator->mode &= ~OutOfProximity;
else if (xE->u.u.type == ProximityOut)
diff --git a/Xi/extinit.c b/Xi/extinit.c
index 2d077b2..cc75d23 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -827,13 +827,16 @@ SetExclusiveAccess(Mask mask)
static void
SetMaskForExtEvent(Mask mask, int event)
{
+ int i;
EventInfo[ExtEventIndex].mask = mask;
EventInfo[ExtEventIndex++].type = event;
if ((event < LASTEvent) || (event >= 128))
FatalError("MaskForExtensionEvent: bogus event number");
- SetMaskForEvent(mask, event);
+
+ for (i = 0; i < MAX_DEVICES; i++)
+ SetMaskForEvent(i, mask, event);
}
/************************************************************************
@@ -974,13 +977,16 @@ FixExtensionEvents(ExtensionEntry * extEntry)
static void
RestoreExtensionEvents(void)
{
- int i;
+ int i, j;
IReqCode = 0;
for (i = 0; i < ExtEventIndex - 1; i++) {
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
- SetMaskForEvent(0, EventInfo[i].type);
+ {
+ for (j = 0; j < MAX_DEVICES; j++)
+ SetMaskForEvent(j, 0, EventInfo[i].type);
+ }
EventInfo[i].mask = 0;
EventInfo[i].type = 0;
}
diff --git a/dix/events.c b/dix/events.c
index 21b0eee..046e4cd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -367,8 +367,12 @@ static Mask lastEventMask;
extern int DeviceMotionNotify;
+/**
+ * Event filters. One set of filters for each device, but only the first layer
+ * is initialized. The rest is memcpy'd in InitEvents.
+ */
#define CantBeFiltered NoEventMask
-static Mask filters[128] =
+static Mask filters[MAX_DEVICES][128] = {
{
NoSuchEvent, /* 0 */
NoSuchEvent, /* 1 */
@@ -405,7 +409,7 @@ static Mask filters[128] =
ColormapChangeMask, /* ColormapNotify */
CantBeFiltered, /* ClientMessage */
CantBeFiltered /* MappingNotify */
-};
+}};
/**
@@ -787,17 +791,19 @@ XineramaChangeToCursor(DeviceIntPtr pDev, CursorPtr cursor)
#endif /* PANORAMIX */
void
-SetMaskForEvent(Mask mask, int event)
+SetMaskForEvent(int deviceid, Mask mask, int event)
{
int coretype;
+ if (deviceid < 0 || deviceid > MAX_DEVICES)
+ FatalError("SetMaskForEvent: bogus device id");
if ((event < LASTEvent) || (event >= 128))
FatalError("SetMaskForEvent: bogus event number");
- filters[event] = mask;
+ filters[deviceid][event] = mask;
/* Need to change the mask for the core events too */
coretype = XItoCoreType(event);
if (coretype)
- filters[coretype] = mask;
+ filters[deviceid][coretype] = mask;
}
_X_EXPORT void
@@ -2440,7 +2446,7 @@ DeliverDeviceEvents(WindowPtr pWin, xEvent *xE, GrabPtr grab,
{
Window child = None;
int type = xE->u.u.type;
- Mask filter = filters[type];
+ Mask filter = filters[dev->id][type];
int deliveries = 0;
if (type & EXTENSION_EVENT_BASE)
@@ -2555,7 +2561,9 @@ DeliverEvents(WindowPtr pWin, xEvent *xE, int count,
if (!count)
return 0;
- filter = filters[xE->u.u.type];
+ /* We don't know a device here. However, this should only ever be called
+ for a non-device event so we are safe to use 0*/
+ filter = filters[0][xE->u.u.type];
if ((filter & SubstructureNotifyMask) && (xE->u.u.type != CreateNotify))
xE->u.destroyNotify.event = pWin->drawable.id;
if (filter != StructureAndSubMask)
@@ -3466,8 +3474,8 @@ CheckPassiveGrabsOnWindow(
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
(void) TryClientEvents(rClient(grab), xE, count,
- filters[xE->u.u.type],
- filters[xE->u.u.type], grab);
+ filters[device->id][xE->u.u.type],
+ filters[device->id][xE->u.u.type], grab);
if (grabinfo->sync.state == FROZEN_NO_EVENT)
{
@@ -3590,7 +3598,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, xEvent *xE, WindowPtr window, int count)
FixUpEventFromWindow(pointer, xE, focus, None, FALSE);
if (xE->u.u.type & EXTENSION_EVENT_BASE)
mskidx = keybd->id;
- (void)DeliverEventsToWindow(keybd, focus, xE, count, filters[xE->u.u.type],
+ (void)DeliverEventsToWindow(keybd, focus, xE, count,
+ filters[keybd->id][xE->u.u.type],
NullGrab, mskidx);
}
@@ -3671,7 +3680,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
IsInterferingGrab(rClient(grab), thisDev, xE)))
{
deliveries = TryClientEvents(rClient(grab), xE, count,
- mask, filters[xE->u.u.type], grab);
+ mask, filters[thisDev->id][xE->u.u.type], grab);
}
}
if (deliveries && (xE->u.u.type == MotionNotify
@@ -3989,7 +3998,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
*/
if (xE->u.u.detail == 0)
return;
- filters[MotionNotify] = Motion_Filter(butc);
+ filters[mouse->id][Motion_Filter(butc)] = MotionNotify;
if (!grab)
if (CheckDeviceGrabs(mouse, xE, 0, count))
return;
@@ -3997,7 +4006,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
case ButtonRelease:
if (xE->u.u.detail == 0)
return;
- filters[MotionNotify] = Motion_Filter(butc);
+ filters[mouse->id][Motion_Filter(butc)] = MotionNotify;
if (!butc->state && mouse->deviceGrab.fromPassiveGrab)
deactivateGrab = TRUE;
break;
@@ -4350,14 +4359,14 @@ EnterLeaveEvent(
sendevent = TRUE;
}
- if ((mask & filters[type]) && sendevent)
+ if ((mask & filters[mouse->id][type]) && sendevent)
{
if (grab)
(void)TryClientEvents(rClient(grab), &event, 1, mask,
- filters[type], grab);
+ filters[mouse->id][type], grab);
else
- (void)DeliverEventsToWindow(mouse, pWin, &event, 1, filters[type],
- NullGrab, 0);
+ (void)DeliverEventsToWindow(mouse, pWin, &event, 1,
+ filters[mouse->id][type], NullGrab, 0);
}
/* we don't have enough bytes, so we squash flags and mode into
@@ -4372,15 +4381,17 @@ EnterLeaveEvent(
mskidx = mouse->id;
inputMasks = wOtherInputMasks(pWin);
if (inputMasks &&
- (filters[devEnterLeave->type] & inputMasks->deliverableEvents[mskidx]))
+ (filters[mouse->id][devEnterLeave->type] &
+ inputMasks->deliverableEvents[mskidx]))
{
if (devgrab)
(void)TryClientEvents(rClient(devgrab), (xEvent*)devEnterLeave, 1,
- mask, filters[devEnterLeave->type], devgrab);
+ mask, filters[mouse->id][devEnterLeave->type],
+ devgrab);
else
(void)DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave,
- 1, filters[devEnterLeave->type],
- NullGrab, mouse->id);
+ 1, filters[mouse->id][devEnterLeave->type],
+ NullGrab, mouse->id);
}
if ((type == EnterNotify) && (mask & KeymapStateMask))
@@ -4579,8 +4590,8 @@ FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
event.u.u.type = type;
event.u.u.detail = detail;
event.u.focus.window = pWin->drawable.id;
- (void)DeliverEventsToWindow(dev, pWin, &event, 1, filters[type], NullGrab,
- 0);
+ (void)DeliverEventsToWindow(dev, pWin, &event, 1,
+ filters[dev->id][type], NullGrab, 0);
if ((type == FocusIn) &&
((pWin->eventMask | wOtherEventMasks(pWin)) & KeymapStateMask))
{
@@ -5528,7 +5539,12 @@ InitEvents(void)
inputInfo.keyboard = (DeviceIntPtr)NULL;
inputInfo.pointer = (DeviceIntPtr)NULL;
lastEventMask = OwnerGrabButtonMask;
- filters[MotionNotify] = PointerMotionMask;
+ filters[0][PointerMotionMask] = MotionNotify;
+ for (i = 1; i < MAX_DEVICES; i++)
+ {
+ memcpy(&filters[i], filters[0], sizeof(filters[0]));
+ }
+
#ifdef XEVIE
xeviewin = NULL;
#endif
diff --git a/include/dix.h b/include/dix.h
index db90579..6da3ee8 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -345,6 +345,7 @@ extern void SetVendorString(char *string);
/* events.c */
extern void SetMaskForEvent(
+ int /* deviceid */,
Mask /* mask */,
int /* event */);
commit 0931f40bf1bd6e00b8d95968d761a495b2c9a46c
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Tue Dec 4 17:08:56 2007 +1030
dix: comments, whitespaces, copyright fixes.
Removing my copyright message for now, should eventually be in line with the
rest of the messages.
diff --git a/dix/events.c b/dix/events.c
index 5242f43..21b0eee 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -107,12 +107,6 @@ of the copyright holder.
******************************************************************/
-/*
- * MPX additions
- * Copyright 2006 by Peter Hutterer
- * Author: Peter Hutterer <peter at cs.unisa.edu.au>
- */
-
/** @file
* This file handles event delivery and a big part of the server-side protocol
* handling (the parts for input devices).
@@ -5022,6 +5016,12 @@ ProcGrabPointer(ClientPtr client)
}
grab = device->deviceGrab.grab;
+ /* check for
+ 1. other client has a grab on the device already.
+ 2. window is viewable
+ 3. other client has this device as frozen "other" device
+ 4. times are screwed.
+ */
if ((grab) && !SameClient(grab, client))
rep.status = AlreadyGrabbed;
else if ((!pWin->realized) ||
diff --git a/dix/getevents.c b/dix/getevents.c
index 6791bd8..9f955cf 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -23,12 +23,6 @@
*
* Author: Daniel Stone <daniel at fooishbar.org>
*/
- /*
- * MPX additions:
- * Copyright © 2006 Peter Hutterer
- * Author: Peter Hutterer <peter at cs.unisa.edu.au>
- *
- */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -112,18 +106,18 @@ key_autorepeats(DeviceIntPtr pDev, int key_code)
}
void
-CreateClassesChangedEvent(EventList* event,
- DeviceIntPtr master,
+CreateClassesChangedEvent(EventList* event,
+ DeviceIntPtr master,
DeviceIntPtr slave)
{
- deviceClassesChangedEvent *dcce;
+ deviceClassesChangedEvent *dcce;
int len = sizeof(xEvent);
CARD32 ms = GetTimeInMillis();
/* XXX: ok, this is a bit weird. We need to alloc enough size for the
* event so it can be filled in in POE lateron. Reason being that if
* we realloc the event in POE we can get SIGABRT when we try to free
- * or realloc the original pointer.
+ * or realloc the original pointer.
* We can only do it here as we don't have the EventList in the event
* processing any more.
*
commit 09c0c1a3cc4807813774a3c0e28a7ba9a87bb5c7
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Tue Dec 4 16:51:52 2007 +1030
dix: remove #ifdef XINPUT.
No escaping XINPUT anymore.
diff --git a/dix/events.c b/dix/events.c
index 418079d..5242f43 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -371,9 +371,7 @@ extern int lastEvent;
static Mask lastEventMask;
-#ifdef XINPUT
extern int DeviceMotionNotify;
-#endif
#define CantBeFiltered NoEventMask
static Mask filters[128] =
@@ -2049,7 +2047,6 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
pEvents->u.u.detail = NotifyNormal;
}
}
-#ifdef XINPUT
else
{
if ((type == DeviceMotionNotify) &&
@@ -2057,7 +2054,6 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
((deviceKeyButtonPointer*)pEvents, mask) != 0)
return 1;
}
-#endif
type &= 0177;
if (type != KeymapNotify)
{
@@ -2271,7 +2267,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
}
else if ((type == MotionNotify) && deliveries)
pDev->valuator->motionHintWindow = pWin;
-#ifdef XINPUT
else
{
if (((type == DeviceMotionNotify)
@@ -2283,7 +2278,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
(deviceKeyButtonPointer*) pEvents,
grab, client, deliveryMask);
}
-#endif
if (deliveries)
return deliveries;
return nondeliveries;
@@ -3395,11 +3389,7 @@ CheckPassiveGrabsOnWindow(
#endif
tempGrab.modifierDevice = grab->modifierDevice;
if ((device == grab->modifierDevice) &&
- ((xE->u.u.type == KeyPress)
-#if defined(XINPUT) && defined(XKB)
- || (xE->u.u.type == DeviceKeyPress)
-#endif
- ))
+ ((xE->u.u.type == KeyPress) || (xE->u.u.type == DeviceKeyPress)))
tempGrab.modifiersDetail.exact =
#ifdef XKB
(noXkbExtension) ?
@@ -3537,11 +3527,8 @@ CheckDeviceGrabs(DeviceIntPtr device, xEvent *xE,
WindowPtr pWin = NULL;
FocusClassPtr focus = device->focus;
- if (((xE->u.u.type == ButtonPress)
-#if defined(XINPUT) && defined(XKB)
- || (xE->u.u.type == DeviceButtonPress)
-#endif
- ) && (device->button->buttonsDown != 1))
+ if (((xE->u.u.type == ButtonPress) || (xE->u.u.type == DeviceButtonPress))
+ && (device->button->buttonsDown != 1))
return FALSE;
i = checkFirst;
@@ -3694,18 +3681,13 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
}
}
if (deliveries && (xE->u.u.type == MotionNotify
-#ifdef XINPUT
- || xE->u.u.type == DeviceMotionNotify
-#endif
- ))
+ || xE->u.u.type == DeviceMotionNotify))
thisDev->valuator->motionHintWindow = grab->window;
}
}
- if (deliveries && !deactivateGrab && (xE->u.u.type != MotionNotify
-#ifdef XINPUT
- && xE->u.u.type != DeviceMotionNotify
-#endif
- ))
+ if (deliveries && !deactivateGrab &&
+ (xE->u.u.type != MotionNotify && xE->u.u.type != DeviceMotionNotify))
+ {
switch (grabinfo->sync.state)
{
case FREEZE_BOTH_NEXT_EVENT:
@@ -3737,6 +3719,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIntPtr thisDev,
*dxE = *xE;
break;
}
+ }
}
/**
@@ -6022,9 +6005,8 @@ DeleteWindowFromAnyEvents(WindowPtr pWin, Bool freeResources)
while ( (passive = wPassiveGrabs(pWin)) )
FreeResource(passive->resource, RT_NONE);
}
-#ifdef XINPUT
+
DeleteWindowFromAnyExtEvents(pWin, freeResources);
-#endif
}
/**
diff --git a/dix/window.c b/dix/window.c
index 51891a8..76e5dec 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -452,7 +452,6 @@ CreateRootWindow(ScreenPtr pScreen)
pWin->optional->clipShape = NULL;
pWin->optional->inputShape = NULL;
#endif
-#ifdef XINPUT
pWin->optional->inputMasks = NULL;
pWin->optional->deviceCursors = NULL;
pWin->optional->geMasks = (GenericClientMasksPtr)xcalloc(1, sizeof(GenericClientMasksRec));
@@ -461,7 +460,6 @@ CreateRootWindow(ScreenPtr pScreen)
xfree(pWin->optional);
return FALSE;
}
-#endif
pWin->optional->access.perm = NULL;
pWin->optional->access.deny = NULL;
@@ -3690,10 +3688,8 @@ CheckWindowOptionalNeed (WindowPtr w)
if (optional->inputShape != NULL)
return;
#endif
-#ifdef XINPUT
if (optional->inputMasks != NULL)
return;
-#endif
if (optional->deviceCursors != NULL)
{
DevCursNodePtr pNode = optional->deviceCursors;
@@ -3753,9 +3749,7 @@ MakeWindowOptional (WindowPtr pWin)
optional->clipShape = NULL;
optional->inputShape = NULL;
#endif
-#ifdef XINPUT
optional->inputMasks = NULL;
-#endif
optional->deviceCursors = NULL;
optional->geMasks =
More information about the xorg-commit
mailing list