Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
0a5e5aa67b
commit
2823cbe34a
|
@ -99,7 +99,7 @@ FRAMELESSHELPER_EXPORT quint32 getWindowDpi(const QWindow *window);
|
|||
FRAMELESSHELPER_EXPORT QMargins getWindowNativeFrameMargins(const QWindow *window);
|
||||
FRAMELESSHELPER_EXPORT QColor getNativeWindowFrameColor(const bool isActive = true);
|
||||
|
||||
FRAMELESSHELPER_EXPORT void displaySystemMenu(const QWindow *window, const QPoint pos = {});
|
||||
FRAMELESSHELPER_EXPORT void displaySystemMenu(const QWindow *window, const QPoint &pos = {});
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -714,7 +714,7 @@ bool Utilities::shouldUseTraditionalBlur()
|
|||
return false;
|
||||
}
|
||||
|
||||
void Utilities::displaySystemMenu(const QWindow *window, const QPoint pos)
|
||||
void Utilities::displaySystemMenu(const QWindow *window, const QPoint &pos)
|
||||
{
|
||||
Q_ASSERT(window);
|
||||
if (!window) {
|
||||
|
@ -776,8 +776,12 @@ void Utilities::displaySystemMenu(const QWindow *window, const QPoint pos)
|
|||
if (isMin) {
|
||||
SetMenuItemInfoW(hMenu, SC_MINIMIZE, FALSE, &mii);
|
||||
}
|
||||
const bool isRtl = QGuiApplication::layoutDirection() == Qt::RightToLeft;
|
||||
const QPoint point = pos.isNull() ? QCursor::pos(window->screen()) : pos;
|
||||
const LPARAM cmd = TrackPopupMenu(hMenu, (TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN), point.x(), point.y(), 0, hwnd, nullptr);
|
||||
const LPARAM cmd = TrackPopupMenu(hMenu,
|
||||
(TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_TOPALIGN |
|
||||
(isRtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN)),
|
||||
point.x(), point.y(), 0, hwnd, nullptr);
|
||||
if (cmd) {
|
||||
PostMessageW(hwnd, WM_SYSCOMMAND, cmd, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue