diff options
author | Yuhang Zhao <2546789017@qq.com> | 2022-08-29 10:43:45 +0800 |
---|---|---|
committer | Yuhang Zhao <2546789017@qq.com> | 2022-09-06 11:49:38 +0800 |
commit | d6a36c521e3dbae591148c19b9ffcabc90cde99b (patch) | |
tree | a0dd4c8896ea27b8e41cfabf09a6daadb8139b9c /src/plugins/platforms/windows/qwindowskeymapper.cpp | |
parent | af4f7fe471c21836df4441079ef0fac082542b6f (diff) |
Windows QPA: Don't highlight the first entry of the system menu if not appropriate
Only menu brought up by keyboard should highlight the first entry,
if the system menu is triggered by right clicking the title bar, there
should be no highlighted menu items.
What we do in QWindowsKeyMapper is not temporary changes, the first entry
will always be highlighted unless we unhighlight it manually.
Amends commit 64d65a645c3f64c6b317aed571366bc049c1cd25
Pick-to: 6.4
Change-Id: I22c887478fd928264bfa35b9b3a8b67e16a6c649
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowskeymapper.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowskeymapper.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 006396d92a..273bed6767 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -817,6 +817,12 @@ static void showSystemMenu(QWindow* w) pos.x(), pos.y() + titleBarOffset, topLevelHwnd, nullptr); + + // Remove the highlight of the restore menu item, otherwise when the user right-clicks + // on the title bar, the popuped system menu will also highlight the restore item, which + // is not appropriate, it should only be highlighted if the menu is brought up by keyboard. + HiliteMenuItem(topLevelHwnd, menu, SC_RESTORE, MF_BYCOMMAND | MFS_UNHILITE); + if (ret) qWindowsWndProc(topLevelHwnd, WM_SYSCOMMAND, WPARAM(ret), 0); } |