[PATCH] Xi/exevents : fix a issue that window can't be closed by touch the close window button

Haibo Chen haibo.chen at freescale.com
Wed Nov 19 03:15:35 PST 2014

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=86459

When matchbox-window-manger(Version 1.2) create a window, there is a
close window button on the top-right of this new window which seems
like "X". If we use a mouse, and click this "X" close window button,
the window can be closed. But when we use multi-touch screen, and
touch this "X" close window button, this window can't be closed, and
nothing changed on the screen. By the way, multi-touch can work normal
when we touch the window's other place except the "X" close button.
And both single touch and mouse can work normal, they can close the
window by touch/click the "X" close window button.

In Xorg(Version 1.16.1), mouse click event, single touch event, and
multi-touch event all call the below function to deliver the coming
event to the target window.

DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab,
                    WindowPtr stopAt, DeviceIntPtr dev)

If we use mouse or single touch to click/touch the "X" close window
button, function ProcessDeviceEvent() call the above function. When the
event->any.type=ET_ButtonPress, the pWin point to the "X" close window
button. The pWin is got by function GetSpriteWindow().

But if we use multi-touch to touch the "X" close window button, function
DeliverTouchEmulatedEvent() call DeliverDeviceEvents(). When the
event->any.type=ET_ButtonPress, the pWin does not point to the "X" close
window button, it actually point to the "X" close window button's parent
window. So in function DeliverDeviceEvents(), when call function
DeliverOneEvent(), the value child is zero, rather than the target window.

This patch use function GetSpriteWindow() to get the pWin in function
DeliverTouchEmulatedEvent() when call DeliverDeviceEvents().

With this patch, mouse, single touch, multi-touch all can work well, including
click/touch the "X" close window button.

Signed-off-by: Haibo Chen <haibo.chen at freescale.com>
 Xi/exevents.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index b0bc47e..e1c523e 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1430,7 +1430,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     else {
         GrabPtr devgrab = dev->deviceGrab.grab;
-        DeliverDeviceEvents(win, ptrev, grab, win, dev);
+        DeliverDeviceEvents(GetSpriteWindow(dev), ptrev, grab, win, dev);
         /* FIXME: bad hack
          * Implicit passive grab activated in response to this event. Store
          * the event.

More information about the xorg mailing list