xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Jul 13 17:05:31 PDT 2009


 dix/devices.c |   13 -----------
 dix/events.c  |   66 ----------------------------------------------------------
 2 files changed, 79 deletions(-)

New commits:
commit 2c535b6f13ffbf2c4ac59834dae39bb8e172c003
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Jul 14 08:58:23 2009 +1000

    dix: don't send presence events for attaching/detaching slave devices.
    
    The code that didn't list attached slave devices for XI1 clients doesn't
    exist anymore, so there's no need for these presence events.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/devices.c b/dix/devices.c
index 8fac981..9f2cb2b 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2391,11 +2391,6 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
         InitializeSprite(dev, currentRoot);
         dev->spriteInfo->spriteOwner = FALSE;
         dev->spriteInfo->paired = dev;
-
-        /* Floating an SD makes it appear to XI 1 clients */
-        SendDevicePresenceEvent(dev->id, DeviceAdded);
-        if (dev->enabled)
-            SendDevicePresenceEvent(dev->id, DeviceEnabled);
     } else
     {
         dev->spriteInfo->sprite = master->spriteInfo->sprite;
@@ -2403,14 +2398,6 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
         dev->spriteInfo->spriteOwner = FALSE;
 
         RecalculateMasterButtons(master);
-
-        if (!oldmaster)
-        {
-            /* Attaching a floating SD makes it disappear to XI 1 clients */
-            if (dev->enabled)
-                SendDevicePresenceEvent(dev->id, DeviceDisabled);
-            SendDevicePresenceEvent(dev->id, DeviceRemoved);
-        }
     }
 
     /* If we were connected to master device before, this MD may need to
commit 0c0ef42292f4c910c73b308cd75d77637312da53
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Sun Jul 12 21:43:06 2009 +1000

    dix: Remove temporary detachment of slave devices.
    
    Previously, an active grab on an attached slave device would send the device
    floating for the duration of the grab. This breaks existing XI applications
    (e.g. the GIMP) since they grab all devices automatically - resulting in the
    loss of control over the VCP.
    
    The behaviour of extended input devices during a grab in relation to the
    core pointer is not specified in the XI protocol specification.
    The removal of the temporary detachment restores the behaviour of extended
    input devices as present in currently released servers - even if a device is
    grabbed, an event from this device will result in an event from the core
    pointer.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index 81e5b6d..52f8b0d 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1444,54 +1444,6 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
     ComputeFreezes();
 }
 
-/* Only ever used if a grab is called on an attached slave device. */
-static int GrabPrivateKeyIndex;
-static DevPrivateKey GrabPrivateKey = &GrabPrivateKeyIndex;
-
-/**
- * Save the device's master device in the devPrivates. This needs to be done
- * if a client directly grabs a slave device that is attached to a master. For
- * the duration of the grab, the device is detached, ungrabbing re-attaches it
- * though.
- *
- * We store the ID of the master device only in case the master disappears
- * while the device has a grab.
- */
-static void
-DetachFromMaster(DeviceIntPtr dev)
-{
-    int id;
-    if (!dev->u.master)
-        return;
-
-    id = dev->u.master->id;
-
-    dixSetPrivate(&dev->devPrivates, GrabPrivateKey, (void *)id);
-    AttachDevice(NULL, dev, NULL);
-}
-
-static void
-ReattachToOldMaster(DeviceIntPtr dev)
-{
-    int id;
-    void *p;
-    DeviceIntPtr master = NULL;
-
-    if (IsMaster(dev))
-        return;
-
-
-    p = dixLookupPrivate(&dev->devPrivates, GrabPrivateKey);
-    id = (int)p; /* silence gcc warnings */
-    dixLookupDevice(&master, id, serverClient, DixUseAccess);
-
-    if (master)
-    {
-        AttachDevice(serverClient, dev, master);
-        dixSetPrivate(&dev->devPrivates, GrabPrivateKey, NULL);
-    }
-}
-
 /**
  * Activate a pointer grab on the given device. A pointer grab will cause all
  * core pointer events of this device to be delivered to the grabbing client only.
@@ -1517,10 +1469,6 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
                         : mouse->spriteInfo->sprite->win;
     Bool isPassive = autoGrab & ~ImplicitGrabMask;
 
-    /* slave devices need to float for the duration of the grab. */
-    if (!(autoGrab & ImplicitGrabMask) && !IsMaster(mouse))
-        DetachFromMaster(mouse);
-
     if (grab->confineTo)
     {
 	if (grab->confineTo->drawable.pScreen
@@ -1555,8 +1503,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
 {
     GrabPtr grab = mouse->deviceGrab.grab;
     DeviceIntPtr dev;
-    Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
-                        mouse->deviceGrab.implicitGrab);
 
     mouse->valuator->motionHintWindow = NullWindow;
     mouse->deviceGrab.grab = NullGrab;
@@ -1576,9 +1522,6 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
     if (grab->cursor)
 	FreeCursor(grab->cursor, (Cursor)0);
 
-    if (!wasImplicit)
-        ReattachToOldMaster(mouse);
-
     ComputeFreezes();
 }
 
@@ -1593,10 +1536,6 @@ ActivateKeyboardGrab(DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool pass
     GrabInfoPtr grabinfo = &keybd->deviceGrab;
     WindowPtr oldWin;
 
-    /* slave devices need to float for the duration of the grab. */
-    if (!(passive & ImplicitGrabMask) && !IsMaster(keybd))
-        DetachFromMaster(keybd);
-
     if (grabinfo->grab)
 	oldWin = grabinfo->grab->window;
     else if (keybd->focus)
@@ -1629,8 +1568,6 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
     DeviceIntPtr dev;
     WindowPtr focusWin = keybd->focus ? keybd->focus->win
                                            : keybd->spriteInfo->sprite->win;
-    Bool wasImplicit = (keybd->deviceGrab.fromPassiveGrab &&
-                        keybd->deviceGrab.implicitGrab);
 
     if (focusWin == FollowKeyboardWin)
 	focusWin = inputInfo.keyboard->focus->win;
@@ -1647,9 +1584,6 @@ DeactivateKeyboardGrab(DeviceIntPtr keybd)
     }
     DoFocusEvents(keybd, grab->window, focusWin, NotifyUngrab);
 
-    if (!wasImplicit)
-        ReattachToOldMaster(keybd);
-
     ComputeFreezes();
 }
 


More information about the xorg-commit mailing list