Sine Striker
2023-12-23 f3721da17996168489778327459084dd227690d6
Adjust paint event handler
3个文件已修改
18 ■■■■ 已修改文件
src/core/contexts/abstractwindowcontext_p.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/windowagentbase.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/widgets/widgetwindowagent_win.cpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/core/contexts/abstractwindowcontext_p.h
@@ -88,7 +88,7 @@
#endif
        QObject *m_titleBar{};
        std::array<QObject *, WindowAgentBase::NumSystemButton> m_systemButtons{};
        std::array<QObject *, WindowAgentBase::Close + 1> m_systemButtons{};
        QVariantHash m_windowAttributes;
src/core/windowagentbase.h
@@ -24,7 +24,6 @@
            Minimize,
            Maximize,
            Close,
            NumSystemButton,
        };
        Q_ENUM(SystemButton)
src/widgets/widgetwindowagent_win.cpp
@@ -9,6 +9,9 @@
namespace QWK {
#if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER)
    class WidgetBorderHandler;
    class WidgetBorderHandler : public QObject, public NativeEventFilter {
    public:
        explicit WidgetBorderHandler(QWidget *widget, AbstractWindowContext *ctx)
@@ -73,6 +76,16 @@
                        (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen))
                        break;
                    // Friend class helping to call `event`
                    class HackedWidget : public QWidget {
                    public:
                        friend class WidgetBorderHandler;
                    };
                    // Let the widget paint first
                    static_cast<HackedWidget *>(widget)->event(event);
                    // Draw border
                    auto paintEvent = static_cast<QPaintEvent *>(event);
                    auto rect = paintEvent->rect();
                    auto region = paintEvent->region();
@@ -84,7 +97,7 @@
                        &region,
                    };
                    ctx->virtual_hook(AbstractWindowContext::DrawWindows10BorderHook, args);
                    break;
                    return true;
                }
                case QEvent::WindowStateChange: {