| | |
| | | #include <QtQuick/QQuickPaintedItem> |
| | | #include <QtQuick/private/qquickitem_p.h> |
| | | |
| | | #include <QWKCore/qwindowkit_windows.h> |
| | | #include <QWKCore/qwkconfig.h> |
| | | #include <QWKCore/private/nativeeventfilter_p.h> |
| | | |
| | | namespace QWK { |
| | | |
| | | #if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER) |
| | | class BorderItem : public QQuickPaintedItem, public NativeEventFilter { |
| | | Q_OBJECT |
| | | public: |
| | | explicit BorderItem(QQuickItem *parent, AbstractWindowContext *context); |
| | | ~BorderItem() override; |
| | |
| | | |
| | | BorderItem::BorderItem(QQuickItem *parent, AbstractWindowContext *context) |
| | | : QQuickPaintedItem(parent), context(context) { |
| | | setAntialiasing(true); // ### FIXME: do we need to enable or disable this? |
| | | setMipmap(true); // ### FIXME: do we need to enable or disable this? |
| | | setAntialiasing(true); // We needs anti-aliasing to give us better result. |
| | | setFillColor({}); // Will improve the performance a little bit. |
| | | setOpaquePainting(true); // Will also improve the performance, we don't draw |
| | | // semi-transparent borders of course. |
| | |
| | | anchors->setLeft(parentPri->left()); |
| | | anchors->setRight(parentPri->right()); |
| | | |
| | | setZ(10); |
| | | setZ(9999); // Make sure our fake border always above everything in the window. |
| | | |
| | | context->installNativeEventFilter(this); |
| | | connect(window(), &QQuickWindow::activeChanged, this, |
| | |
| | | bool BorderItem::nativeEventFilter(const QByteArray &eventType, void *message, |
| | | QT_NATIVE_EVENT_RESULT_TYPE *result) { |
| | | Q_UNUSED(eventType) |
| | | auto msg = reinterpret_cast<const MSG *>(message); |
| | | const auto msg = static_cast<const MSG *>(message); |
| | | switch (msg->message) { |
| | | case WM_THEMECHANGED: |
| | | case WM_SYSCOLORCHANGE: |
| | |
| | | void BorderItem::_q_windowActivityChanged() { |
| | | update(); |
| | | } |
| | | #endif |
| | | |
| | | void QuickWindowAgentPrivate::setupWindows10BorderWorkaround() { |
| | | #if QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDER) |
| | | // Install painting hook |
| | | auto ctx = context.get(); |
| | | if (ctx->property("needBorderPainter").toBool()) { |
| | | std::ignore = new BorderItem(hostWindow->contentItem(), ctx); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | } |
| | | |
| | | #include "quickwindowagent_win.moc" |