[PATCH 05/12] dix: No DeviceEnterLeave events in server 1.6

Peter Hutterer peter.hutterer at who-t.net
Thu Nov 27 23:03:03 PST 2008


From: Peter Hutterer <peter.hutterer at redhat.com>

---
 Xi/exevents.c    |    4 ---
 Xi/extinit.c     |   41 ------------------------------
 dix/enterleave.c |   36 --------------------------
 dix/events.c     |   73 ------------------------------------------------------
 xkb/xkbEvents.c  |    4 ---
 5 files changed, 0 insertions(+), 158 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index c520c7d..fbd03aa 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -122,8 +122,6 @@ IsPointerEvent(xEvent* xE)
             if (xE->u.u.type == DeviceButtonPress ||
                 xE->u.u.type == DeviceButtonRelease ||
                 xE->u.u.type == DeviceMotionNotify ||
-                xE->u.u.type == DeviceEnterNotify ||
-                xE->u.u.type == DeviceLeaveNotify ||
                 xE->u.u.type == ProximityIn ||
                 xE->u.u.type == ProximityOut)
             {
@@ -145,8 +143,6 @@ XIGetDevice(xEvent* xE)
     if (xE->u.u.type == DeviceButtonPress ||
         xE->u.u.type == DeviceButtonRelease ||
         xE->u.u.type == DeviceMotionNotify ||
-        xE->u.u.type == DeviceEnterNotify ||
-        xE->u.u.type == DeviceLeaveNotify ||
         xE->u.u.type == ProximityIn ||
         xE->u.u.type == ProximityOut ||
         xE->u.u.type == DevicePropertyNotify)
diff --git a/Xi/extinit.c b/Xi/extinit.c
index d167b76..df71ae2 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -274,8 +274,6 @@ Mask DeviceButtonGrabMask;
 Mask DeviceButtonMotionMask;
 Mask DevicePresenceNotifyMask;
 Mask DevicePropertyNotifyMask;
-Mask DeviceEnterWindowMask;
-Mask DeviceLeaveWindowMask;
 
 int DeviceValuator;
 int DeviceKeyPress;
@@ -294,8 +292,6 @@ int DeviceMappingNotify;
 int ChangeDeviceNotify;
 int DevicePresenceNotify;
 int DevicePropertyNotify;
-int DeviceEnterNotify;
-int DeviceLeaveNotify;
 
 int RT_INPUTCLIENT;
 
@@ -563,23 +559,6 @@ SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to
 }
 
 static void
-SDeviceLeaveNotifyEvent (deviceLeaveNotify *from, deviceLeaveNotify *to)
-{
-    char n;
-
-    *to = *from;
-    swaps(&to->sequenceNumber,n);
-    swapl(&to->time, n);
-    swapl(&to->root, n);
-    swapl(&to->event, n);
-    swapl(&to->child, n);
-    swaps(&to->rootX, n);
-    swaps(&to->rootY, n);
-    swaps(&to->eventX, n);
-    swaps(&to->eventY, n);
-}
-
-static void
 SDeviceClassesChangedEvent(deviceClassesChangedEvent* from,
                            deviceClassesChangedEvent* to)
 {
@@ -750,8 +729,6 @@ FixExtensionEvents(ExtensionEntry * extEntry)
     DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
     DevicePresenceNotify = DeviceButtonStateNotify + 1;
     DevicePropertyNotify = DevicePresenceNotify + 1;
-    DeviceEnterNotify = DevicePropertyNotify + 1;
-    DeviceLeaveNotify = DeviceEnterNotify + 1;
 
     event_base[KeyClass] = DeviceKeyPress;
     event_base[ButtonClass] = DeviceButtonPress;
@@ -843,14 +820,6 @@ FixExtensionEvents(ExtensionEntry * extEntry)
     DevicePropertyNotifyMask = GetNextExtEventMask();
     SetMaskForExtEvent(DevicePropertyNotifyMask, DevicePropertyNotify);
 
-    DeviceEnterWindowMask = GetNextExtEventMask();
-    SetMaskForExtEvent(DeviceEnterWindowMask, DeviceEnterNotify);
-    AllowPropagateSuppress(DeviceEnterWindowMask);
-
-    DeviceLeaveWindowMask = GetNextExtEventMask();
-    SetMaskForExtEvent(DeviceLeaveWindowMask, DeviceLeaveNotify);
-    AllowPropagateSuppress(DeviceLeaveWindowMask);
-
     SetEventInfo(0, _noExtensionEvent);
 }
 
@@ -897,8 +866,6 @@ RestoreExtensionEvents(void)
     DeviceButtonStateNotify = 13;
     DevicePresenceNotify = 14;
     DevicePropertyNotify = 15;
-    DeviceEnterNotify = 16;
-    DeviceLeaveNotify = 17;
 
     BadDevice = 0;
     BadEvent = 1;
@@ -938,8 +905,6 @@ IResetProc(ExtensionEntry * unused)
     EventSwapVector[ChangeDeviceNotify] = NotImplemented;
     EventSwapVector[DevicePresenceNotify] = NotImplemented;
     EventSwapVector[DevicePropertyNotify] = NotImplemented;
-    EventSwapVector[DeviceEnterNotify] = NotImplemented;
-    EventSwapVector[DeviceLeaveNotify] = NotImplemented;
     RestoreExtensionEvents();
 }
 
@@ -1043,10 +1008,6 @@ SEventIDispatch(xEvent * from, xEvent * to)
 	DO_SWAP(SDevicePresenceNotifyEvent, devicePresenceNotify);
     else if (type == DevicePropertyNotify)
 	DO_SWAP(SDevicePropertyNotifyEvent, devicePropertyNotify);
-    else if (type == DeviceEnterNotify)
-        DO_SWAP(SDeviceLeaveNotifyEvent, deviceEnterNotify);
-    else if (type == DeviceLeaveNotify)
-        DO_SWAP(SDeviceLeaveNotifyEvent, deviceLeaveNotify);
     else {
 	FatalError("XInputExtension: Impossible event!\n");
     }
@@ -1133,8 +1094,6 @@ XInputExtensionInit(void)
 	EventSwapVector[DeviceMappingNotify] = SEventIDispatch;
 	EventSwapVector[ChangeDeviceNotify] = SEventIDispatch;
 	EventSwapVector[DevicePresenceNotify] = SEventIDispatch;
-	EventSwapVector[DeviceEnterNotify] = SEventIDispatch;
-	EventSwapVector[DeviceLeaveNotify] = SEventIDispatch;
 
         /* init GE events */
         GERegisterExtension(IReqCode, XIGEEventSwap, XIGEEventFill);
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 8176f96..d16f922 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -193,9 +193,6 @@ EnterNotifies(DeviceIntPtr dev,
     if (core)
         CoreEnterLeaveEvent(dev, EnterNotify, mode, detail, parent,
                             child->drawable.id);
-    else
-        DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, detail, parent,
-                              child->drawable.id);
 }
 
 /**
@@ -219,9 +216,6 @@ LeaveNotifies(DeviceIntPtr dev,
         if (core)
             CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win,
                             child->drawable.id);
-        else
-            DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, detail, win,
-                                  child->drawable.id);
         child = win;
     }
 }
@@ -489,35 +483,6 @@ CoreEnterLeaveEvents(DeviceIntPtr dev,
     EnterWindow(dev, to, mode);
 }
 
-static void
-DeviceEnterLeaveEvents(DeviceIntPtr dev,
-                       WindowPtr    from,
-                       WindowPtr    to,
-                       int          mode)
-{
-    if (IsParent(from, to))
-    {
-        DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyInferior, from, None);
-        EnterNotifies(dev, from, to, mode, NotifyVirtual, FALSE);
-        DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyAncestor, to, None);
-    }
-    else if (IsParent(to, from))
-    {
-	DeviceEnterLeaveEvent(dev, DeviceLeaveNotify, mode, NotifyAncestor, from, None);
-	LeaveNotifies(dev, from, to, mode, NotifyVirtual, FALSE);
-	DeviceEnterLeaveEvent(dev, DeviceEnterNotify, 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, DeviceLeaveNotify, mode, NotifyNonlinear, from, None);
-        LeaveNotifies(dev, from, common, mode, NotifyNonlinearVirtual, FALSE);
-	EnterNotifies(dev, common, to, mode, NotifyNonlinearVirtual, FALSE);
-        DeviceEnterLeaveEvent(dev, DeviceEnterNotify, mode, NotifyNonlinear, to, None);
-    }
-}
-
 /**
  * Figure out if enter/leave events are necessary and send them to the
  * appropriate windows.
@@ -538,5 +503,4 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
 	return;
 
     CoreEnterLeaveEvents(pDev, fromWin, toWin, mode);
-    DeviceEnterLeaveEvents(pDev, fromWin, toWin, mode);
 }
diff --git a/dix/events.c b/dix/events.c
index bfc8494..d1dc8ed 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4274,79 +4274,6 @@ CoreEnterLeaveEvent(
     }
 }
 
-void
-DeviceEnterLeaveEvent(
-    DeviceIntPtr mouse,
-    int type,
-    int mode,
-    int detail,
-    WindowPtr pWin,
-    Window child)
-{
-    xEvent              event;
-    GrabPtr             grab = mouse->deviceGrab.grab;
-    deviceEnterNotify   *devEnterLeave;
-    int                 mskidx;
-    OtherInputMasks     *inputMasks;
-    Mask                mask;
-    DeviceIntPtr        keybd = GetPairedDevice(mouse);
-    BOOL                sameScreen;
-
-    if (grab) {
-        mask = (pWin == grab->window) ? grab->eventMask : 0;
-        if (grab->ownerEvents)
-            mask |= EventMaskForClient(pWin, rClient(grab));
-    } else {
-        mask = pWin->eventMask | wOtherEventMasks(pWin);
-    }
-
-    /* we don't have enough bytes, so we squash flags and mode into
-       one byte, and use the last byte for the deviceid. */
-    devEnterLeave           = (deviceEnterNotify*)&event;
-    devEnterLeave->detail   = detail;
-    devEnterLeave->time     = currentTime.milliseconds;
-    devEnterLeave->rootX    = mouse->spriteInfo->sprite->hot.x;
-    devEnterLeave->rootY    = mouse->spriteInfo->sprite->hot.y;
-    FixUpEventFromWindow(mouse, &event, pWin, None, FALSE);
-    sameScreen = event.u.keyButtonPointer.sameScreen;
-
-    devEnterLeave->child    = child;
-    devEnterLeave->type     = type;
-    devEnterLeave->deviceid = mouse->id;
-    devEnterLeave->mode     = mode;
-    devEnterLeave->mode    |= (sameScreen ?  (ELFlagSameScreen << 4) : 0);
-
-#ifdef XKB
-    if (!noXkbExtension) {
-        devEnterLeave->state = mouse->button->state & 0x1f00;
-        if (keybd)
-            devEnterLeave->state |=
-                XkbGrabStateFromRec(&keybd->key->xkbInfo->state);
-    } else
-#endif
-    {
-        devEnterLeave->state = (keybd) ? keybd->key->state : 0;
-        devEnterLeave->state |= mouse->button->state;
-    }
-
-    mskidx = mouse->id;
-    inputMasks = wOtherInputMasks(pWin);
-    if (inputMasks &&
-       (filters[mouse->id][devEnterLeave->type] &
-            inputMasks->deliverableEvents[mskidx]))
-    {
-        if (grab)
-            TryClientEvents(rClient(grab), mouse,
-                            (xEvent*)devEnterLeave, 1, mask,
-                            filters[mouse->id][devEnterLeave->type], grab);
-        else
-            DeliverEventsToWindow(mouse, pWin, (xEvent*)devEnterLeave, 1,
-                                  filters[mouse->id][devEnterLeave->type],
-                                  NullGrab, mouse->id);
-    }
-
-}
-
 static void
 FocusEvent(DeviceIntPtr dev, int type, int mode, int detail, WindowPtr pWin)
 {
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index 151849c..67bd674 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -921,10 +921,6 @@ XkbSrvInfoPtr	xkbi;
 		     new|= xkbi->state.compat_lookup_mods;
 		else new|= xkbi->state.compat_grab_mods;
                 kbp->state= new;
-            } else if ((type==DeviceEnterNotify)||(type==DeviceLeaveNotify)) {
-                deviceEnterNotify *del = (deviceEnterNotify*)&xE[i];
-                del->state&=0x1F00;
-                del->state|= xkbi->state.compat_grab_mods;
             }
 	    button_mask = 1 << xE[i].u.u.detail;
 	    if (type == ButtonPress &&
-- 
1.6.0.3




More information about the xorg mailing list