Zhao Yuhang
2023-12-09 651805739be12125295d992c3e6ae00b6bef9fe2
minor tweaks
2个文件已修改
35 ■■■■■ 已修改文件
examples/mainwindow/main.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/win32windowcontext.cpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/mainwindow/main.cpp
@@ -6,6 +6,10 @@
    qputenv("QT_WIN_DEBUG_CONSOLE", "1");
    qputenv("QSG_INFO", "1");
    qputenv("QT_WIDGETS_HIGHDPI_DOWNSCALE", "1");
    qputenv("QT_WIDGETS_RHI", "1");
    qputenv("QSG_RHI_BACKEND", "d3d12");
    qputenv("QSG_RHI_HDR", "scrgb");
    qputenv("QT_QPA_DISABLE_REDIRECTION_SURFACE", "1");
    QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
    QApplication a(argc, argv);
    MainWindow w;
src/core/contexts/win32windowcontext.cpp
@@ -764,10 +764,6 @@
            return false;
        }
        if (systemMenuHandler(hWnd, message, wParam, lParam, result)) {
            return true;
        }
        // Test snap layout
        if (snapLayoutHandler(hWnd, message, wParam, lParam, result)) {
            return true;
@@ -775,6 +771,10 @@
        // Main implementation
        if (customWindowHandler(hWnd, message, wParam, lParam, result)) {
            return true;
        }
        if (systemMenuHandler(hWnd, message, wParam, lParam, result)) {
            return true;
        }
@@ -1187,22 +1187,31 @@
                    // this is also the normal behavior of a native Win32 window (but only when the
                    // window is not maximized/fullscreen/minimized, of course).
                    if (isWindowNoState(hWnd)) {
                        static constexpr const int kBorderSize = 2;
                        static constexpr const auto kBorderSize = quint8{2};
                        bool isTop = (nativeLocalPos.y <= kBorderSize);
                        bool isLeft = nativeLocalPos.x <= kBorderSize;
                        bool isRight = (nativeLocalPos.x >= (clientWidth - kBorderSize));
                        if (isTop || isRight) {
                        if (isTop || isLeft || isRight) {
                            if (dontOverrideCursor) {
                                // The user doesn't want the window to be resized, so we tell
                                // Windows we are in the client area so that the controls beneath
                                // the mouse cursor can still be hovered or clicked.
                                *result = (isTitleBar ? HTCAPTION : HTCLIENT);
                            } else {
                                if (isTop && isRight) {
                                    *result = HTTOPRIGHT;
                                } else if (isTop) {
                                    *result = HTTOP;
                                if (isTop) {
                                    if (isLeft) {
                                        *result = HTTOPLEFT;
                                    } else if (isRight) {
                                        *result = HTTOPRIGHT;
                                    } else {
                                        *result = HTTOP;
                                    }
                                } else {
                                    *result = HTRIGHT;
                                    if (isLeft) {
                                        *result = HTLEFT;
                                    } else {
                                        *result = HTRIGHT;
                                    }
                                }
                            }
                        }