| | |
| | | #include "widgetwindowagent_p.h" |
| | | |
| | | #include <QWKCore/qwkconfig.h> |
| | | #include <QWKCore/qwkglobal.h> |
| | | |
| | | #include <QtGui/QPainter> |
| | | |
| | | #include <QWKCore/qwindowkit_windows.h> |
| | |
| | | |
| | | namespace QWK { |
| | | |
| | | #if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER) |
| | | class WidgetBorderHandler : public QObject, public NativeEventFilter { |
| | | Q_OBJECT |
| | | public: |
| | | explicit WidgetBorderHandler(QWidget *widget, AbstractWindowContext *ctx) |
| | | : QObject(ctx), widget(widget), ctx(ctx) { |
| | |
| | | } |
| | | |
| | | bool eventFilter(QObject *obj, QEvent *event) override { |
| | | Q_UNUSED(obj) |
| | | switch (event->type()) { |
| | | case QEvent::Paint: { |
| | | if (widget->windowState() & (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)) |
| | | if (widget->windowState() & |
| | | (Qt::WindowMinimized | Qt::WindowMaximized | Qt::WindowFullScreen)) |
| | | break; |
| | | |
| | | auto paintEvent = static_cast<QPaintEvent *>(event); |
| | |
| | | QWidget *widget; |
| | | AbstractWindowContext *ctx; |
| | | }; |
| | | #endif |
| | | |
| | | void WidgetWindowAgentPrivate::setupWindows10BorderWorkaround() { |
| | | #if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER) |
| | | // Install painting hook |
| | | auto ctx = context.get(); |
| | | if (ctx->property("needBorderPainter").toBool()) { |
| | | std::ignore = new WidgetBorderHandler(hostWidget, ctx); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | } |
| | | |
| | | #include "widgetwindowagent_win.moc" |