diff options
author | Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com> | 2013-11-25 19:45:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-03 11:40:50 +0100 |
commit | 5361513ec812c545ca2cedea6c8a30c362cb8e5d (patch) | |
tree | c7dc64e4d8cb955971104fe3a26726a68b7eaa83 | |
parent | 923d498029be406a684f8953afc68f10c07e2789 (diff) | |
download | qtbase-5361513ec812c545ca2cedea6c8a30c362cb8e5d.tar.gz |
Cocoa: Mouse enter events on window activation.
This patch tells the window system that it should create a mouse enter
event if a window was activated when the mouse was inside. This wasn't
working and was a regression.
Task-number: QTBUG-35109
[ChangeLog][Cocoa] Fix enterEvent not being called on activate.
Change-Id: I4e4662b4a4c58dafa8d0a2c09458ab88f678d243
Reviewed-by: Liang Qi <liang.qi@digia.com>
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindowdelegate.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindowdelegate.mm | 11 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index ca2a15a1cc..403f8dc78a 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -93,6 +93,8 @@ QT_END_NAMESPACE - (BOOL)hasMask; - (BOOL)isOpaque; +- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint; + - (void)resetMouseButtons; - (void)handleMouseEvent:(NSEvent *)theEvent; diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 06e11fffbb..5717551cc3 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -53,6 +53,7 @@ - (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow; +- (void)windowDidBecomeKey:(NSNotification *)notification; - (void)windowDidResize:(NSNotification *)notification; - (void)windowDidMove:(NSNotification *)notification; - (void)windowWillMove:(NSNotification *)notification; diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 10536bd5f4..c9b3d69381 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -56,6 +56,17 @@ return self; } +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + Q_UNUSED(notification); + if (m_cocoaWindow->m_windowUnderMouse) { + QPointF windowPoint; + QPointF screenPoint; + [m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); + } +} + - (void)windowDidResize:(NSNotification *)notification { Q_UNUSED(notification); |