From ba9c21f7a1398ddcdeee6f010b1477d79f5bb8ce Mon Sep 17 00:00:00 2001
From: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
Date: Fri, 19 Feb 2010 16:11:19 +0100
Subject: Cocoa: calling QEventLoop::exec from mouse up causes problem

If one create e.g. a modal dialog from a mouse up event handler, we
qt_button_down global variable was pointing to a widget before the
handler returned. This meant that you could not push another button
in the window, since the qt_button_down would grab the mouse. This
patch clears qt_button_down before sending mouse up events.

Reviewed-by: denis
---
 src/gui/kernel/qt_cocoa_helpers_mac.mm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index b400d25..9702829 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -983,6 +983,7 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
             button = Qt::RightButton;
             [theView qt_setLeftButtonIsRightButton: false];
         }
+        qt_button_down = 0;
         break;
     }
     [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]->localPoint = localPoint;
-- 
cgit v0.12