summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowscontext.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-02-17 20:31:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-17 20:31:38 +0100
commite88011357e5dd3b0ae4e6bc715ef29e5f4f3ffab (patch)
treec5b05d45e49194d70ff4defae41e5d5d5cf75e80 /src/plugins/platforms/windows/qwindowscontext.cpp
parent2df8884bc68343ad96962e7496b98d6e585c0347 (diff)
parente65cd6f3794e12e6bc5c2ee985eae8e70ff5f333 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index c658a1814f..a6709dffb3 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -869,8 +869,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
#ifndef QT_NO_CONTEXTMENU
case QtWindows::ContextMenu:
- handleContextMenuEvent(platformWindow->window(), msg);
- return true;
+ return handleContextMenuEvent(platformWindow->window(), msg);
#endif
default:
break;
@@ -904,7 +903,7 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
}
#ifndef QT_NO_CONTEXTMENU
-void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
+bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
{
bool mouseTriggered = false;
QPoint globalPos;
@@ -914,10 +913,23 @@ void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
globalPos.setX(msg.pt.x);
globalPos.setY(msg.pt.y);
pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos);
+
+ RECT clientRect;
+ if (GetClientRect(msg.hwnd, &clientRect)) {
+ if (pos.x() < (int)clientRect.left || pos.x() >= (int)clientRect.right ||
+ pos.y() < (int)clientRect.top || pos.y() >= (int)clientRect.bottom)
+ {
+ // This is the case that user has right clicked in the window's caption,
+ // We should call DefWindowProc() to display a default shortcut menu
+ // instead of sending a Qt window system event.
+ return false;
+ }
+ }
}
QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos,
QWindowsKeyMapper::queryKeyboardModifiers());
+ return true;
}
#endif