Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jan 2011 12:24:09 -0500
From:      Brian Fundakowski Feldman <bfeldman@hammers.com>
To:        x11@FreeBSD.org
Subject:   xorg-server Motif-right-click-menu fix
Message-ID:  <4D3DB5B9.1040209@hammers.com>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030606020609060108030703
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

This has been driving me crazy for a long time and I tracked it down to 
a bug that was fixed in an older xorg-server release but not the later 
releases (it did eventually get merged forward, though.)  All Motif 
applications have unusable right-click menus because the cursor stays
trapped in them until you kill the program entirely.

I confirmed this makes Motif usable for right-click menus again.  Would 
you mind turning this into xorg-server-1.7.5_1,1?

Thank you!

-- 
Brian Fundakowski Feldman

--------------030606020609060108030703
Content-Type: text/plain;
 name="patch-dix-events.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="patch-dix-events.c"

>From 873ef3430e92b0756c0dbe5033f6aec38a20d6ad Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 16 Dec 2009 13:43:22 +1000
Subject: [PATCH] dix: if owner-events is true for passive grabs, add the window mask (#25400)

A client requesting a GrabModeSync button grab, owner-events true, with only
the ButtonRelease mask set would never receive the press event even if the
grab window had the ButtonPress mask set.

The protocol requires that if owner-events is true, then the delivery mask
is the combination of the grab mask + the window event mask.

X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>;

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
 dix/events.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 7e0867c..12b12a8 100644
--- dix/events.c
+++ dix/events.c
@@ -3590,6 +3590,8 @@ CheckPassiveGrabsOnWindow(
                 xE = &core;
                 count = 1;
                 mask = grab->eventMask;
+                if (grab->ownerEvents)
+                    mask |= pWin->eventMask;
             } else if (match & XI2_MATCH)
             {
                 rc = EventToXI2((InternalEvent*)event, &xE);
@@ -3611,6 +3613,24 @@ CheckPassiveGrabsOnWindow(
                     mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
                 else if (event->type == XI_Enter || event->type == XI_FocusIn)
                     mask = grab->xi2mask[device->id][event->type/8];
+
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type;
+                            mask |= icp->xi2mask[device->id][evtype/8];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             } else
             {
                 rc = EventToXI((InternalEvent*)event, &xE, &count);
@@ -3622,6 +3642,22 @@ CheckPassiveGrabsOnWindow(
                     continue;
                 }
                 mask = grab->eventMask;
+                if (grab->ownerEvents && wOtherInputMasks(grab->window))
+                {
+                    InputClientsPtr icp =
+                        wOtherInputMasks(grab->window)->inputClients;
+
+                    while(icp)
+                    {
+                        if (rClient(icp) == rClient(grab))
+                        {
+                            mask |= icp->mask[device->id];
+                            break;
+                        }
+
+                        icp = icp->next;
+                    }
+                }
             }
 
 	    (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
-- 
1.6.5.2


--------------030606020609060108030703--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D3DB5B9.1040209>