diff options
author | Andy Shaw <andy.shaw@digia.com> | 2013-01-23 13:29:02 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-27 11:19:34 (GMT) |
commit | 23cda4768990e7a0ed13544930d7a02deb9757ae (patch) | |
tree | cf491bc59fc2417c4155836fa46603635e06c68f /src/gui/kernel | |
parent | b05b9a4c7def41488d8cc29ee4c977de29b1416b (diff) | |
download | Qt-23cda4768990e7a0ed13544930d7a02deb9757ae.zip Qt-23cda4768990e7a0ed13544930d7a02deb9757ae.tar.gz Qt-23cda4768990e7a0ed13544930d7a02deb9757ae.tar.bz2 |
Only send the enter/leave event when it makes sense to do so
When show/hide is called on a widget on Mac then it needs to send an
enter/leave event. But it should only do that if the widget under the
mouse is actually the one that is being shown/hidden.
Change-Id: I53c782f5deee740cbc34e1fcc7b551a108230081
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 01150aa..702a56b 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3556,10 +3556,12 @@ void QWidgetPrivate::show_sys() QPoint qlocal, qglobal; QWidget *widgetUnderMouse = 0; qt_mac_getTargetForMouseEvent(0, QEvent::Enter, qlocal, qglobal, 0, &widgetUnderMouse); - QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_mouse_receiver); - qt_last_mouse_receiver = widgetUnderMouse; - qt_last_native_mouse_receiver = widgetUnderMouse ? - (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; + if (q == widgetUnderMouse) { + QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_mouse_receiver); + qt_last_mouse_receiver = widgetUnderMouse; + qt_last_native_mouse_receiver = widgetUnderMouse ? + (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; + } } #endif @@ -3716,10 +3718,12 @@ void QWidgetPrivate::hide_sys() QPoint qlocal, qglobal; QWidget *widgetUnderMouse = 0; qt_mac_getTargetForMouseEvent(0, QEvent::Leave, qlocal, qglobal, 0, &widgetUnderMouse); - QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_native_mouse_receiver); - qt_last_mouse_receiver = widgetUnderMouse; - qt_last_native_mouse_receiver = widgetUnderMouse ? - (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; + if (q == widgetUnderMouse) { + QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_native_mouse_receiver); + qt_last_mouse_receiver = widgetUnderMouse; + qt_last_native_mouse_receiver = widgetUnderMouse ? + (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0; + } } #endif |