dix: fix up device enter/leave for XI_Enter/XI_Leave.
This commit is contained in:
parent
0befeb36c1
commit
181e41511d
31
Xi/extinit.c
31
Xi/extinit.c
|
@ -602,20 +602,28 @@ SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to)
|
SDeviceLeaveNotifyEvent (xXILeaveEvent *from, xXILeaveEvent *to)
|
||||||
{
|
{
|
||||||
char n;
|
char n;
|
||||||
|
|
||||||
*to = *from;
|
*to = *from;
|
||||||
swaps(&to->sequenceNumber,n);
|
swaps(&to->sequenceNumber,n);
|
||||||
|
swapl(&to->length, n);
|
||||||
|
swaps(&to->evtype, n);
|
||||||
|
swaps(&to->deviceid, n);
|
||||||
swapl(&to->time, n);
|
swapl(&to->time, n);
|
||||||
swapl(&to->root, n);
|
swapl(&to->root, n);
|
||||||
swapl(&to->event, n);
|
swapl(&to->event, n);
|
||||||
swapl(&to->child, n);
|
swapl(&to->child, n);
|
||||||
swaps(&to->rootX, n);
|
swaps(&to->root_x.integral, n);
|
||||||
swaps(&to->rootY, n);
|
swaps(&to->root_x.frac, n);
|
||||||
swaps(&to->eventX, n);
|
swaps(&to->root_y.integral, n);
|
||||||
swaps(&to->eventY, n);
|
swaps(&to->root_y.frac, n);
|
||||||
|
swaps(&to->event_x.integral, n);
|
||||||
|
swaps(&to->event_x.frac, n);
|
||||||
|
swaps(&to->event_y.integral, n);
|
||||||
|
swaps(&to->event_y.frac, n);
|
||||||
|
swaps(&to->sourceid, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -669,6 +677,13 @@ SDeviceClassesChangedEvent(deviceClassesChangedEvent* from,
|
||||||
static void
|
static void
|
||||||
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
||||||
{
|
{
|
||||||
|
switch(from->evtype)
|
||||||
|
{
|
||||||
|
case XI_Enter:
|
||||||
|
case XI_Leave:
|
||||||
|
SDeviceLeaveNotifyEvent((xXILeaveEvent*)from, (xXILeaveEvent*)to);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -1025,10 +1040,6 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
||||||
DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
|
DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
|
||||||
else if (type == DevicePropertyNotify)
|
else if (type == DevicePropertyNotify)
|
||||||
DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
|
DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
|
||||||
else if (type == DeviceEnterNotify)
|
|
||||||
DO_SWAP(SDeviceLeaveNotifyEvent, deviceEnterNotify);
|
|
||||||
else if (type == DeviceLeaveNotify)
|
|
||||||
DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify);
|
|
||||||
else {
|
else {
|
||||||
FatalError("XInputExtension: Impossible event!\n");
|
FatalError("XInputExtension: Impossible event!\n");
|
||||||
}
|
}
|
||||||
|
@ -1084,8 +1095,6 @@ XInputExtensionInit(void)
|
||||||
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
|
||||||
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
|
||||||
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
|
EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
|
||||||
EventSwapVector[DeviceEnterNotify] = SEventIDispatch;
|
|
||||||
EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
|
|
||||||
|
|
||||||
GERegisterExtension(IReqCode, XI2EventSwap);
|
GERegisterExtension(IReqCode, XI2EventSwap);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
|
#include <X11/extensions/XI2.h>
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
#include "exglobals.h"
|
#include "exglobals.h"
|
||||||
|
@ -228,7 +229,7 @@ DeviceEnterNotifies(DeviceIntPtr dev,
|
||||||
if (ancestor == parent)
|
if (ancestor == parent)
|
||||||
return;
|
return;
|
||||||
DeviceEnterNotifies(dev, ancestor, parent, mode, detail);
|
DeviceEnterNotifies(dev, ancestor, parent, mode, detail);
|
||||||
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, detail, parent,
|
DeviceEnterLeaveEvent(dev, XI_Enter, mode, detail, parent,
|
||||||
child->drawable.id);
|
child->drawable.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +335,7 @@ DeviceLeaveNotifies(DeviceIntPtr dev,
|
||||||
return;
|
return;
|
||||||
for (win = child->parent; win != ancestor; win = win->parent)
|
for (win = child->parent; win != ancestor; win = win->parent)
|
||||||
{
|
{
|
||||||
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, detail, win,
|
DeviceEnterLeaveEvent(dev, XI_Leave, mode, detail, win,
|
||||||
child->drawable.id);
|
child->drawable.id);
|
||||||
child = win;
|
child = win;
|
||||||
}
|
}
|
||||||
|
@ -568,24 +569,24 @@ DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
||||||
{
|
{
|
||||||
if (IsParent(from, to))
|
if (IsParent(from, to))
|
||||||
{
|
{
|
||||||
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyInferior, from, None);
|
DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyInferior, from, None);
|
||||||
DeviceEnterNotifies(dev, from, to, mode, NotifyVirtual);
|
DeviceEnterNotifies(dev, from, to, mode, NotifyVirtual);
|
||||||
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyAncestor, to, None);
|
DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyAncestor, to, None);
|
||||||
}
|
}
|
||||||
else if (IsParent(to, from))
|
else if (IsParent(to, from))
|
||||||
{
|
{
|
||||||
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyAncestor, from, None);
|
DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyAncestor, from, None);
|
||||||
DeviceLeaveNotifies(dev, from, to, mode, NotifyVirtual);
|
DeviceLeaveNotifies(dev, from, to, mode, NotifyVirtual);
|
||||||
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyInferior, to, None);
|
DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyInferior, to, None);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* neither from nor to is descendent of the other */
|
{ /* neither from nor to is descendent of the other */
|
||||||
WindowPtr common = CommonAncestor(to, from);
|
WindowPtr common = CommonAncestor(to, from);
|
||||||
/* common == NullWindow ==> different screens */
|
/* common == NullWindow ==> different screens */
|
||||||
DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyNonlinear, from, None);
|
DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyNonlinear, from, None);
|
||||||
DeviceLeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual);
|
DeviceLeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual);
|
||||||
DeviceEnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual);
|
DeviceEnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual);
|
||||||
DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyNonlinear, to, None);
|
DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyNonlinear, to, None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
51
dix/events.c
51
dix/events.c
|
@ -3994,14 +3994,12 @@ DeviceEnterLeaveEvent(
|
||||||
WindowPtr pWin,
|
WindowPtr pWin,
|
||||||
Window child)
|
Window child)
|
||||||
{
|
{
|
||||||
xEvent event;
|
|
||||||
GrabPtr grab = mouse->deviceGrab.grab;
|
GrabPtr grab = mouse->deviceGrab.grab;
|
||||||
deviceEnterNotify *devEnterLeave;
|
xXIEnterEvent event;
|
||||||
int mskidx;
|
int mskidx;
|
||||||
OtherInputMasks *inputMasks;
|
OtherInputMasks *inputMasks;
|
||||||
Mask mask;
|
Mask mask;
|
||||||
DeviceIntPtr keybd = GetPairedDevice(mouse);
|
xEvent dummy;
|
||||||
BOOL sameScreen;
|
|
||||||
|
|
||||||
if (grab) {
|
if (grab) {
|
||||||
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
||||||
|
@ -4011,41 +4009,40 @@ DeviceEnterLeaveEvent(
|
||||||
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we don't have enough bytes, so we squash flags and mode into
|
memset(&event, 0, sizeof(event));
|
||||||
one byte, and use the last byte for the deviceid. */
|
event.type = GenericEvent;
|
||||||
memset(&event, 0, sizeof(xEvent));
|
event.extension = IReqCode;
|
||||||
devEnterLeave = (deviceEnterNotify*)&event;
|
event.evtype = type;
|
||||||
devEnterLeave->type = type;
|
event.detail = detail;
|
||||||
devEnterLeave->detail = detail;
|
event.time = currentTime.milliseconds;
|
||||||
devEnterLeave->time = currentTime.milliseconds;
|
event.deviceid = mouse->id;
|
||||||
devEnterLeave->rootX = mouse->spriteInfo->sprite->hot.x;
|
event.sourceid = 0; /*XXX */
|
||||||
devEnterLeave->rootY = mouse->spriteInfo->sprite->hot.y;
|
event.mode = mode;
|
||||||
FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
|
event.root_x.integral = mouse->spriteInfo->sprite->hot.x;
|
||||||
sameScreen = event.u.keyButtonPointer.sameScreen;
|
event.root_y.integral = mouse->spriteInfo->sprite->hot.y;
|
||||||
|
|
||||||
devEnterLeave->child = child;
|
/* We use FUEFW to fill in dummy, then copy the values */
|
||||||
devEnterLeave->deviceid = mouse->id;
|
FixUpEventFromWindow(mouse, &dummy, pWin, None, FALSE);
|
||||||
devEnterLeave->mode = mode;
|
|
||||||
devEnterLeave->mode |= (sameScreen ? (ELFlagSameScreen << 4) : 0);
|
|
||||||
|
|
||||||
devEnterLeave->state = mouse->button->state & 0x1f00;
|
event.same_screen = dummy.u.keyButtonPointer.sameScreen;
|
||||||
if (keybd && keybd->key)
|
event.child = dummy.u.keyButtonPointer.child;
|
||||||
devEnterLeave->state |= XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
|
event.event_x.integral = dummy.u.keyButtonPointer.eventX;
|
||||||
|
event.event_y.integral = dummy.u.keyButtonPointer.eventY;
|
||||||
|
|
||||||
mskidx = mouse->id;
|
mskidx = mouse->id;
|
||||||
inputMasks = wOtherInputMasks(pWin);
|
inputMasks = wOtherInputMasks(pWin);
|
||||||
if (inputMasks &&
|
if (inputMasks &&
|
||||||
(GetEventFilter(mouse, (xEvent*)devEnterLeave) &
|
(GetEventFilter(mouse, (xEvent*)&event) &
|
||||||
inputMasks->deliverableEvents[mskidx]))
|
inputMasks->deliverableEvents[mskidx]))
|
||||||
{
|
{
|
||||||
if (grab)
|
if (grab)
|
||||||
TryClientEvents(rClient(grab), mouse,
|
TryClientEvents(rClient(grab), mouse,
|
||||||
(xEvent*)devEnterLeave, 1, mask,
|
(xEvent*)&event, 1, mask,
|
||||||
GetEventFilter(mouse, (xEvent*)devEnterLeave),
|
GetEventFilter(mouse, (xEvent*)&event),
|
||||||
grab);
|
grab);
|
||||||
else
|
else
|
||||||
DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave, 1,
|
DeliverEventsToWindow(mouse, pWin, (xEvent*)&event, 1,
|
||||||
GetEventFilter(mouse, (xEvent*)devEnterLeave),
|
GetEventFilter(mouse, (xEvent*)&event),
|
||||||
NullGrab, mouse->id);
|
NullGrab, mouse->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue