[PATCH 1/2] dix: Pass EVENT_*_MASK flags to DoLeaveEnterEvents()
carlosg at gnome.org
carlosg at gnome.org
Mon Nov 25 09:14:37 PST 2013
From: Carlos Garnacho <carlosg at gnome.org>
This way the function can decide on whether sending Core and/or XI2
events through other means than the crossing mode. XI1 has no crossing
events and is hence unhandled.
One notable behavior change is that the XINotifyPassiveGrab/Ungrab
modes are translated to NotifyGrab/Ungrab if core crossing events were
specified in the mask.
Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
---
dix/enterleave.c | 24 ++++++++++++++++++++----
dix/enterleave.h | 3 ++-
dix/events.c | 21 ++++++++++++++-------
include/input.h | 2 +-
4 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 54f4b85..3c3c046 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -594,17 +594,33 @@ DeviceEnterLeaveEvents(DeviceIntPtr dev,
*/
void
DoEnterLeaveEvents(DeviceIntPtr pDev,
- int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode)
+ int sourceid, WindowPtr fromWin, WindowPtr toWin,
+ int mode, int mask)
{
+ if (mask & EVENT_DONT_PROPAGATE_MASK)
+ return;
+
if (!IsPointerDevice(pDev))
return;
if (fromWin == toWin)
return;
- if (mode != XINotifyPassiveGrab && mode != XINotifyPassiveUngrab)
- CoreEnterLeaveEvents(pDev, fromWin, toWin, mode);
- DeviceEnterLeaveEvents(pDev, sourceid, fromWin, toWin, mode);
+ if (mask & EVENT_CORE_MASK) {
+ int core_mode;
+
+ if (mode == XINotifyPassiveGrab)
+ core_mode = NotifyGrab;
+ else if (mode == XINotifyPassiveUngrab)
+ core_mode = NotifyUngrab;
+ else /* All other modes are binary-equivalent */
+ core_mode = mode;
+
+ CoreEnterLeaveEvents(pDev, fromWin, toWin, core_mode);
+ }
+
+ if (mask & EVENT_XI2_MASK)
+ DeviceEnterLeaveEvents(pDev, sourceid, fromWin, toWin, mode);
}
static void
diff --git a/dix/enterleave.h b/dix/enterleave.h
index a59d057..6c0f6f6 100644
--- a/dix/enterleave.h
+++ b/dix/enterleave.h
@@ -35,7 +35,8 @@
extern void DoEnterLeaveEvents(DeviceIntPtr pDev,
int sourceid,
- WindowPtr fromWin, WindowPtr toWin, int mode);
+ WindowPtr fromWin, WindowPtr toWin,
+ int mode, int mask);
extern void EnterLeaveEvent(DeviceIntPtr mouse,
int type,
diff --git a/dix/events.c b/dix/events.c
index 4632bb7..9260b45 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1530,7 +1530,8 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
mouse->spriteInfo->sprite->hotPhys.y = 0;
ConfineCursorToWindow(mouse, grab->confineTo, FALSE, TRUE);
}
- DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab);
+ DoEnterLeaveEvents(mouse, mouse->id, oldWin, grab->window, NotifyGrab,
+ EVENT_CORE_MASK | EVENT_XI2_MASK);
mouse->valuator->motionHintWindow = NullWindow;
if (syncEvents.playingEvents)
grabinfo->grabTime = syncEvents.time;
@@ -1597,7 +1598,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
dev->deviceGrab.sync.other = NullGrab;
}
DoEnterLeaveEvents(mouse, mouse->id, grab->window,
- mouse->spriteInfo->sprite->win, NotifyUngrab);
+ mouse->spriteInfo->sprite->win, NotifyUngrab,
+ EVENT_CORE_MASK | EVENT_XI2_MASK);
if (grab->confineTo)
ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE);
PostNewCursor(mouse);
@@ -2937,7 +2939,8 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win))
return FALSE;
- DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
+ DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab,
+ EVENT_XI2_MASK);
(*dev->deviceGrab.DeactivateGrab) (dev);
}
@@ -2956,7 +2959,8 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
- DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
+ DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab,
+ EVENT_XI2_MASK);
return rc;
}
@@ -2978,7 +2982,8 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
dev->deviceGrab.grab->window == win ||
IsParent(dev->deviceGrab.grab->window, win))
return FALSE;
- DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
+ DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab,
+ EVENT_XI2_MASK);
(*dev->deviceGrab.DeactivateGrab) (dev);
}
@@ -2994,7 +2999,8 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
rc = (CheckPassiveGrabsOnWindow(win, dev, (InternalEvent *) &event, FALSE,
TRUE) != NULL);
if (rc)
- DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab);
+ DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab,
+ EVENT_XI2_MASK);
return rc;
}
@@ -3108,7 +3114,8 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
if (prevSpriteWin != NullWindow) {
if (!ActivateEnterGrab(pDev, prevSpriteWin, newSpriteWin))
DoEnterLeaveEvents(pDev, sourceid, prevSpriteWin,
- newSpriteWin, NotifyNormal);
+ newSpriteWin, NotifyNormal,
+ EVENT_CORE_MASK | EVENT_XI2_MASK);
}
/* set pSprite->win after ActivateEnterGrab, otherwise
sprite window == grab_window and no enter/leave events are
diff --git a/include/input.h b/include/input.h
index 2d5e531..50f6938 100644
--- a/include/input.h
+++ b/include/input.h
@@ -607,7 +607,7 @@ extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
InternalEvent *ev, InternalEvent *real_event);
/**
* Masks specifying the type of event to deliver for an InternalEvent; used
- * by EventIsDeliverable.
+ * by EventIsDeliverable and DoEnterLeaveEvents.
* @defgroup EventIsDeliverable return flags
* @{
*/
--
1.8.4.2
More information about the xorg-devel
mailing list