diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-29 16:34:28 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-07-30 11:04:28 +1000 |
commit | 46ac9f92416f3cb99b5d84a9d200237dc33a3bb7 (patch) | |
tree | b700bba014262617ccd149398e432b7d7b0a2cc1 /dix | |
parent | c299b2228fb63c192b72851c90e14ceaceb67bbc (diff) |
dix: pass the sourceid around for enter/leave events.
The sourceid for enter/leave events as a result of pointer motion is the ID
of the slave device. The sourceid for those as a result of a grab activating
is the device itself.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/enterleave.c | 32 | ||||
-rw-r--r-- | dix/enterleave.h | 2 | ||||
-rw-r--r-- | dix/events.c | 23 |
3 files changed, 34 insertions, 23 deletions
diff --git a/dix/enterleave.c b/dix/enterleave.c index a476f8fe0..09b9f5527 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -218,6 +218,7 @@ CommonAncestor( */ static void DeviceEnterNotifies(DeviceIntPtr dev, + int sourceid, WindowPtr ancestor, WindowPtr child, int mode, @@ -227,8 +228,8 @@ DeviceEnterNotifies(DeviceIntPtr dev, if (ancestor == parent) return; - DeviceEnterNotifies(dev, ancestor, parent, mode, detail); - DeviceEnterLeaveEvent(dev, XI_Enter, mode, detail, parent, + DeviceEnterNotifies(dev, sourceid, ancestor, parent, mode, detail); + DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, detail, parent, child->drawable.id); } @@ -323,6 +324,7 @@ CoreLeaveNotifies(DeviceIntPtr dev, */ static void DeviceLeaveNotifies(DeviceIntPtr dev, + int sourceid, WindowPtr child, WindowPtr ancestor, int mode, @@ -334,7 +336,7 @@ DeviceLeaveNotifies(DeviceIntPtr dev, return; for (win = child->parent; win != ancestor; win = win->parent) { - DeviceEnterLeaveEvent(dev, XI_Leave, mode, detail, win, + DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, detail, win, child->drawable.id); child = win; } @@ -562,30 +564,31 @@ CoreEnterLeaveEvents(DeviceIntPtr dev, static void DeviceEnterLeaveEvents(DeviceIntPtr dev, + int sourceid, WindowPtr from, WindowPtr to, int mode) { if (IsParent(from, to)) { - DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyInferior, from, None); - DeviceEnterNotifies(dev, from, to, mode, NotifyVirtual); - DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyAncestor, to, None); + DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, from, None); + DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual); + DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to, None); } else if (IsParent(to, from)) { - DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyAncestor, from, None); - DeviceLeaveNotifies(dev, from, to, mode, NotifyVirtual); - DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyInferior, to, None); + DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, from, None); + DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual); + DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyInferior, to, None); } else { /* neither from nor to is descendent of the other */ WindowPtr common = CommonAncestor(to, from); /* common == NullWindow ==> different screens */ - DeviceEnterLeaveEvent(dev, XI_Leave, mode, NotifyNonlinear, from, None); - DeviceLeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual); - DeviceEnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual); - DeviceEnterLeaveEvent(dev, XI_Enter, mode, NotifyNonlinear, to, None); + DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear, from, None); + DeviceLeaveNotifies(dev, sourceid, from, common, mode, NotifyNonlinearVirtual); + DeviceEnterNotifies(dev, sourceid, common, to, mode, NotifyNonlinearVirtual); + DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear, to, None); } } @@ -598,6 +601,7 @@ DeviceEnterLeaveEvents(DeviceIntPtr dev, */ void DoEnterLeaveEvents(DeviceIntPtr pDev, + int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode) @@ -610,7 +614,7 @@ DoEnterLeaveEvents(DeviceIntPtr pDev, if (mode != XINotifyPassiveGrab && mode != XINotifyPassiveUngrab) CoreEnterLeaveEvents(pDev, fromWin, toWin, mode); - DeviceEnterLeaveEvents(pDev, fromWin, toWin, mode); + DeviceEnterLeaveEvents(pDev, sourceid, fromWin, toWin, mode); } /** diff --git a/dix/enterleave.h b/dix/enterleave.h index edca38664..746c5d4b0 100644 --- a/dix/enterleave.h +++ b/dix/enterleave.h @@ -33,6 +33,7 @@ extern void DoEnterLeaveEvents( DeviceIntPtr pDev, + int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode @@ -64,6 +65,7 @@ extern void CoreEnterLeaveEvent(DeviceIntPtr mouse, WindowPtr pWin, Window child); extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse, + int sourceid, int type, int mode, int detail, diff --git a/dix/events.c b/dix/events.c index 5aef03ea2..de8d5598e 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1474,7 +1474,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab, mouse->spriteInfo->sprite->hotPhys.y = 0; ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE); } - DoEnterLeaveEvents(mouse, oldWin, grab->window, NotifyGrab); + DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab); mouse->valuator->motionHintWindow = NullWindow; if (syncEvents.playingEvents) grabinfo->grabTime = syncEvents.time; @@ -1511,7 +1511,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) if (dev->deviceGrab.sync.other == grab) dev->deviceGrab.sync.other = NullGrab; } - DoEnterLeaveEvents(mouse, grab->window, + DoEnterLeaveEvents(mouse, mouse->id, grab->window, mouse->spriteInfo->sprite->win, NotifyUngrab); if (grab->confineTo) ConfineCursorToWindow(mouse, RootWindow(mouse), FALSE, FALSE); @@ -2585,7 +2585,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) if (dev->deviceGrab.grab->window == win || IsParent(dev->deviceGrab.grab->window, win)) return FALSE; - DoEnterLeaveEvents(dev, old, win, XINotifyPassiveUngrab); + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); (*dev->deviceGrab.DeactivateGrab)(dev); } @@ -2602,7 +2602,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) event.detail.button = 0; rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); if (rc) - DoEnterLeaveEvents(dev, old, win, XINotifyPassiveUngrab); + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); return rc; } @@ -2625,7 +2625,7 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) if (dev->deviceGrab.grab->window == win || IsParent(dev->deviceGrab.grab->window, win)) return FALSE; - DoEnterLeaveEvents(dev, old, win, XINotifyPassiveUngrab); + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); (*dev->deviceGrab.DeactivateGrab)(dev); } @@ -2639,7 +2639,7 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) event.detail.button = 0; rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); if (rc) - DoEnterLeaveEvents(dev, old, win, XINotifyPassiveGrab); + DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab); return rc; } @@ -2740,12 +2740,16 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) if (newSpriteWin != prevSpriteWin) { - if (!ev) + int sourceid; + if (!ev) { UpdateCurrentTimeIf(); + sourceid = pDev->id; /* when from WindowsRestructured */ + } else + sourceid = ev->sourceid; if (prevSpriteWin != NullWindow) { if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin)) - DoEnterLeaveEvents(pDev, prevSpriteWin, + DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin, newSpriteWin, NotifyNormal); } /* set pSprite->win after ActivateEnterGrab, otherwise @@ -4216,6 +4220,7 @@ CoreEnterLeaveEvent( void DeviceEnterLeaveEvent( DeviceIntPtr mouse, + int sourceid, int type, int mode, int detail, @@ -4245,7 +4250,7 @@ DeviceEnterLeaveEvent( event->detail = detail; event->time = currentTime.milliseconds; event->deviceid = mouse->id; - event->sourceid = 0; /*XXX */ + event->sourceid = sourceid; event->mode = mode; event->root_x = FP1616(mouse->spriteInfo->sprite->hot.x, 0); event->root_y = FP1616(mouse->spriteInfo->sprite->hot.y, 0); |