xserver: Branch 'mpx' - 4 commits

Peter Hutterer whot at kemper.freedesktop.org
Wed Oct 3 00:15:51 PDT 2007


 dix/events.c     |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
 xkb/xkbActions.c |    8 -------
 2 files changed, 56 insertions(+), 13 deletions(-)

New commits:
diff-tree 9f2b493e34e93881101f31e631901d3fe56da4f0 (from 1eebb03a3190947a8102f2ddc73766cf98d34c84)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Thu Sep 27 15:35:41 2007 +0930

    xkb: remove some warning comments.
    
    Obsolete with 340911d7243a7f1095d79b5b2dcfa81b145c2474.

diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 891b915..dd4d7c1 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -907,10 +907,6 @@ ProcessInputProc backupproc;
 
 	realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
 	xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
-        /* XXX: Bad! Since the switch to XI devices xkbi->device will be the
-         * XI device. Sending a core event through ProcessOtherEvent will
-         * cause trouble. Somebody should fix this. 
-         */
 	UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
 	xkbi->device->public.processInputProc(&ev,xkbi->device,1);
 	COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
@@ -953,10 +949,6 @@ ProcessInputProc backupproc;
 
 	realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
 	xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
-        /* XXX: Bad! Since the switch to XI devices xkbi->device will be the
-         * XI device. Sending a core event through ProcessOtherEvent will
-         * cause trouble. Somebody should fix this. 
-         */
 	UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
 	xkbi->device->public.processInputProc(&ev,xkbi->device,1);
 	COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
diff-tree 1eebb03a3190947a8102f2ddc73766cf98d34c84 (from 0b485067823620b5dbd9ef2b3e13bd35ad5a4410)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Oct 3 15:18:17 2007 +0930

    dix: ignore passive grab if the client already has a grab on the device.
    
    In some cases a button press may activate a passive core grab. If the client
    owning the passive grab already has a core grab on another device, don't
    actually activate it. Otherwise the client gets two simultaneous passive
    core grabs, and may never ungrab the device again (only if the other grab uses
    GrabModeSync).
    
    Reproducable: fire up gnome-session, open up gnome-terminal. Click with the
    ClientPointer onto the window decoration, then click with another pointer onto
    an application icon in the panel. Drag the icon out, release the button and
    voila - you just lost your second mouse.

diff --git a/dix/events.c b/dix/events.c
index 6489292..8141a40 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3297,6 +3297,35 @@ CheckPassiveGrabsOnWindow(
                 grab->modifierDevice = GetPairedKeyboard(device);
             }
 
+            /* In some cases a passive core grab may exist, but the client
+             * already has a core grab on some other device. In this case we
+             * must not get the grab, otherwise we may never ungrab the
+             * device.
+             */
+
+            if (grab->coreGrab)
+            {
+                DeviceIntPtr other;
+                BOOL interfering = FALSE;
+                for (other = inputInfo.devices; other; other = other->next)
+                {
+                    GrabPtr othergrab = other->deviceGrab.grab;
+                    if (othergrab && othergrab->coreGrab &&
+                        SameClient(grab, rClient(othergrab)) &&
+                        ((IsPointerDevice(grab->device) &&
+                         IsPointerDevice(othergrab->device)) ||
+                         (IsKeyboardDevice(grab->device) &&
+                          IsKeyboardDevice(othergrab->device))))
+                    {
+                        interfering = TRUE;
+                        break;
+                    }
+                }
+                if (interfering)
+                    continue;
+            }
+
+
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
  
 	    FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
diff-tree 0b485067823620b5dbd9ef2b3e13bd35ad5a4410 (from 05106ac9839102c0e4a3ce5d9d83d19abf129f8a)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Oct 3 14:22:55 2007 +0930

    dix: send NotifyGrab/NotifyUngrab focus events regardless of semaphore state.
    
    This is just papering over a problem. The whole focus system needs to be
    revised.

diff --git a/dix/events.c b/dix/events.c
index 35abffd..6489292 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4374,7 +4374,7 @@ FocusEvent(DeviceIntPtr dev, int type, i
      * For standard events (NotifyAncestor, NotifyInferior, NotifyNonlinear)
      * we only send an FocusIn event for the first kbd to set the focus. A
      * FocusOut event is sent for the last kbd to set the focus away from the
-     * window.. 
+     * window.
      *
      * For events with Virtual detail, we send them only to a window that does
      * not have a focus from another keyboard.
@@ -4392,7 +4392,9 @@ FocusEvent(DeviceIntPtr dev, int type, i
 
     numFoci =
         &((FocusSemaphoresPtr)pWin->devPrivates[FocusPrivatesIndex].ptr)->focusinout;
-    if (detail != NotifyVirtual && 
+    if (mode == NotifyGrab || mode == NotifyUngrab)
+        sendevent = TRUE;
+    else if (detail != NotifyVirtual && 
             detail != NotifyNonlinearVirtual && 
             detail != NotifyPointer &&
             detail != NotifyPointerRoot &&
diff-tree 05106ac9839102c0e4a3ce5d9d83d19abf129f8a (from f965a5f3454a95ddffb2faf9b291feff46305adf)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date:   Wed Oct 3 11:33:10 2007 +0930

    dix: change Enter/Leave semaphore handling to accommodate for NotifyGrab.
    
    This is a half-assed attempt at getting rid of some enter-leave problems. When
    a grab is activated, the events didn't get sent before, leading to interesting
    results. This commit papers over it but doesn't actually fix it properly. The
    whole enter/leave (focusin/out) structure needs to be ripped out and changed
    for multiple devices.

diff --git a/dix/events.c b/dix/events.c
index 6eac090..35abffd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4160,7 +4160,7 @@ EnterLeaveEvent(
      * Sending multiple core enter/leave events to the same window confuse the
      * client.  
      * We can send multiple events that have detail NotifyVirtual or
-     * NotifyNonlinearVirtual however.
+     * NotifyNonlinearVirtual however. For most clients anyway.
      *
      * For standard events (NotifyAncestor, NotifyInferior, NotifyNonlinear)
      * we only send an enter event for the first pointer to enter. A leave
@@ -4183,8 +4183,6 @@ EnterLeaveEvent(
     if (event.u.u.detail != NotifyVirtual && 
             event.u.u.detail != NotifyNonlinearVirtual)
     {
-        (type == EnterNotify) ? (*inWindow)++ : (*inWindow)--;
-
         if (((*inWindow) == (LeaveNotify - type)))
             sendevent = TRUE;
     } else
@@ -4289,6 +4287,22 @@ LeaveNotifies(DeviceIntPtr pDev, 
     }
 }
 
+#define FOCUS_SEMAPHORE_MODIFY(win, field, mode, val) \
+    { \
+        if (mode != NotifyGrab && mode != NotifyUngrab) \
+        { \
+            FocusSemaphoresPtr sem;\
+            sem = (FocusSemaphoresPtr)win->devPrivates[FocusPrivatesIndex].ptr; \
+            sem->field += val; \
+        } \
+    }
+#define ENTER_LEAVE_SEMAPHORE_UP(win, mode)  \
+        FOCUS_SEMAPHORE_MODIFY(win, enterleave, mode, 1); 
+
+#define ENTER_LEAVE_SEMAPHORE_DOWN(win, mode) \
+        FOCUS_SEMAPHORE_MODIFY(win, enterleave, mode,  -1);
+
+
 /**
  * Figure out if enter/leave events are necessary and send them to the
  * appropriate windows.
@@ -4306,27 +4320,33 @@ DoEnterLeaveEvents(DeviceIntPtr pDev, 
 	return;
     if (IsParent(fromWin, toWin))
     {
+        ENTER_LEAVE_SEMAPHORE_DOWN(fromWin, mode); 
         EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyInferior, fromWin,
                         None); 
         EnterNotifies(pDev, fromWin, toWin, mode,
                       NotifyVirtual);
+        ENTER_LEAVE_SEMAPHORE_UP(toWin, mode);
         EnterLeaveEvent(pDev, EnterNotify, mode, NotifyAncestor, toWin, None);
     }
     else if (IsParent(toWin, fromWin))
     {
+        ENTER_LEAVE_SEMAPHORE_DOWN(fromWin, mode); 
 	EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyAncestor, fromWin, 
                         None);
 	LeaveNotifies(pDev, fromWin, toWin, mode, NotifyVirtual);
+        ENTER_LEAVE_SEMAPHORE_UP(toWin, mode);
 	EnterLeaveEvent(pDev, EnterNotify, mode, NotifyInferior, toWin, None);
     }
     else
     { /* neither fromWin nor toWin is descendent of the other */
 	WindowPtr common = CommonAncestor(toWin, fromWin);
 	/* common == NullWindow ==> different screens */
+        ENTER_LEAVE_SEMAPHORE_DOWN(fromWin, mode); 
         EnterLeaveEvent(pDev, LeaveNotify, mode, NotifyNonlinear, fromWin,
                         None); 
         LeaveNotifies(pDev, fromWin, common, mode, NotifyNonlinearVirtual);
 	EnterNotifies(pDev, common, toWin, mode, NotifyNonlinearVirtual);
+        ENTER_LEAVE_SEMAPHORE_UP(toWin, mode);
         EnterLeaveEvent(pDev, EnterNotify, mode, NotifyNonlinear, toWin,
                         None); 
     }


More information about the xorg-commit mailing list