diff options
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qtwindowsglobal.h | 5 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 23 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.h | 3 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 73f963b6b8..7ff8edb588 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -105,6 +105,7 @@ enum WindowsEventType // Simplify event types ThemeChanged = ThemingEventFlag + 1, DisplayChangedEvent = 437, SettingChangedEvent = DisplayChangedEvent + 1, + ContextMenu = 123, UnknownEvent = 542 }; @@ -194,6 +195,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::DisplayChangedEvent; case WM_THEMECHANGED: return QtWindows::ThemeChanged; +#ifndef QT_NO_CONTEXTMENU + case WM_CONTEXTMENU: + return QtWindows::ContextMenu; +#endif default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 3d4871d7a2..42db58ae6c 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -869,6 +869,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, QWindowsWindow::baseWindowOf(modalWindow)->alertWindow(); break; #endif +#ifndef QT_NO_CONTEXTMENU + case QtWindows::ContextMenu: + handleContextMenuEvent(platformWindow->window(), msg); + return true; +#endif default: break; } @@ -900,6 +905,24 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et, } } +#ifndef QT_NO_CONTEXTMENU +void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg) +{ + bool mouseTriggered = false; + QPoint globalPos; + QPoint pos; + if (msg.lParam != (int)0xffffffff) { + mouseTriggered = true; + globalPos.setX(msg.pt.x); + globalPos.setY(msg.pt.y); + pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos); + } + + QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos, + QWindowsKeyMapper::queryKeyboardModifiers()); +} +#endif + /*! \brief Windows functions for actual windows. diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index dcc636bfc0..ef48a52e07 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -187,6 +187,9 @@ public: private: void handleFocusEvent(QtWindows::WindowsEventType et, QWindowsWindow *w); +#ifndef QT_NO_CONTEXTMENU + void handleContextMenuEvent(QWindow *window, const MSG &msg); +#endif void unregisterWindowClasses(); QScopedPointer<QWindowsContextPrivate> d; |