summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2009-11-26 02:21:23 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-11-26 02:21:23 (GMT)
commitc1d03a7aa71e8b1081fb263efcc925d8968af526 (patch)
tree915122018e21c6b9622462ddaa1ad3edd83348f8
parent035f6e3454a512cef69fdf62a8f93c7f600ed553 (diff)
downloadQt-c1d03a7aa71e8b1081fb263efcc925d8968af526.zip
Qt-c1d03a7aa71e8b1081fb263efcc925d8968af526.tar.gz
Qt-c1d03a7aa71e8b1081fb263efcc925d8968af526.tar.bz2
Revert "Fixes implicit grabbing in Qt/Cocoa"
This reverts commit 49360b3237363db2a8d6c6eeafb0aaa83d3efdc0.
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm51
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm8
2 files changed, 30 insertions, 29 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 4229d4e..d02cf94 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -79,7 +79,6 @@ extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm
extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
extern QPointer<QWidget> qt_mouseover; //qapplication_mac.mm
-extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
@@ -692,9 +691,6 @@ extern "C" {
- (void)mouseDown:(NSEvent *)theEvent
{
- if (!qt_button_down)
- qt_button_down = qwidget;
-
qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton);
// Don't call super here. This prevents us from getting the mouseUp event,
// which we need to send even if the mouseDown event was not accepted.
@@ -704,62 +700,75 @@ extern "C" {
- (void)mouseUp:(NSEvent *)theEvent
{
- qt_button_down = 0;
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::LeftButton);
+ if (!mouseOK)
+ [super mouseUp:theEvent];
}
- (void)rightMouseDown:(NSEvent *)theEvent
{
- if (!qt_button_down)
- qt_button_down = qwidget;
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::RightButton);
+ if (!mouseOK)
+ [super rightMouseDown:theEvent];
}
- (void)rightMouseUp:(NSEvent *)theEvent
{
- qt_button_down = 0;
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, Qt::RightButton);
+ if (!mouseOK)
+ [super rightMouseUp:theEvent];
}
- (void)otherMouseDown:(NSEvent *)theEvent
{
- if (!qt_button_down)
- qt_button_down = qwidget;
-
Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, mouseButton);
+
+ if (!mouseOK)
+ [super otherMouseDown:theEvent];
}
- (void)otherMouseUp:(NSEvent *)theEvent
{
- qt_button_down = 0;
-
Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonRelease, mouseButton);
+
+ if (!mouseOK)
+ [super otherMouseUp:theEvent];
+
}
- (void)mouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+
+ if (!mouseOK)
+ [super mouseDragged:theEvent];
}
- (void)rightMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+
+ if (!mouseOK)
+ [super rightMouseDragged:theEvent];
}
- (void)otherMouseDragged:(NSEvent *)theEvent
{
qMacDnDParams()->view = self;
qMacDnDParams()->theEvent = theEvent;
- qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+ bool mouseOK = qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseMove, Qt::NoButton);
+
+ if (!mouseOK)
+ [super otherMouseDragged:theEvent];
}
- (void)scrollWheel:(NSEvent *)theEvent
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 563f0b8..d17225c 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -899,14 +899,6 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
widgetToGetMouse =
[static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget];
}
- } else {
- extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
- if (!mac_mouse_grabber && qt_button_down) {
- // if there is no explicit grabber, and the mouse was grabbed
- // implicitely (i.e. a mousebutton was pressed)
- widgetToGetMouse = qt_button_down;
- tmpView = qt_mac_nativeview_for(widgetToGetMouse);
- }
}
NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil];