Zhao Yuhang
2024-05-07 357532958f2e806c69c96f018333a45e65e35201
src/core/contexts/win32windowcontext.cpp
@@ -2128,8 +2128,14 @@
        if (shouldShowSystemMenu) {
            bool triggeredByIconButton = iconButtonClickTime > 0;
            if (triggeredByIconButton) {
                // TODO: Adjust `nativeGlobalPos` to (0, realTitleBarHeight)
                // hint: use m_delgegate->mapGeometryToScene
                POINT menuPos{ 0, static_cast<LONG>(getTitleBarHeight(hWnd)) };
                if (const auto tb = titleBar()) {
                    auto titleBarHeight = qreal(m_delegate->mapGeometryToScene(tb).height());
                    titleBarHeight *= m_windowHandle->devicePixelRatio();
                    menuPos.y = qRound(titleBarHeight);
                }
                ::ClientToScreen(hWnd, &menuPos);
                nativeGlobalPos = menuPos;
            }
            bool res = showSystemMenu_sys(hWnd, nativeGlobalPos, broughtByKeyboard,
                                          m_delegate->isHostSizeFixed(m_host));