diff --git a/debian/changelog b/debian/changelog index 99e06b3..f5842ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -cutefish-qtplugins (0.5) UNRELEASED; urgency=high +cutefish-qt-plugins (0.5) UNRELEASED; urgency=high * Initial release (CutefishOS) - -- CutefishOS Packaging Team Thu, 16 Sep 2021 02:31:42 +0800 \ No newline at end of file + -- CutefishOS Packaging Team Thu, 16 Sep 2021 02:31:42 +0800 diff --git a/debian/control b/debian/control index 4e50dfa..c2cb146 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: cutefish-qtplugins +Source: cutefish-qt-plugins Section: devel Priority: optional Maintainer: CutefishOS @@ -20,7 +20,7 @@ Build-Depends: cmake, Standards-Version: 4.5.0 Homepage: https://cutefishos.com -Package: cutefish-qtplugins +Package: cutefish-qt-plugins Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} diff --git a/widgetstyle/basestyle.cpp b/widgetstyle/basestyle.cpp index 7904196..480f2bf 100644 --- a/widgetstyle/basestyle.cpp +++ b/widgetstyle/basestyle.cpp @@ -2170,10 +2170,12 @@ void BaseStyle::drawPrimitive(PrimitiveElement elem, // blur if (widget && widget->window()) { - QPainterPath path; - path.addRoundedRect(option->rect, Phantom::DefaultFrame_Radius, Phantom::DefaultFrame_Radius); - const_cast(widget)->setMask(path.toFillPolygon().toPolygon()); - m_blurHelper->update(const_cast(widget)); +// QPainterPath path; +// path.addRoundedRect(option->rect, Phantom::DefaultFrame_Radius, Phantom::DefaultFrame_Radius); +// const_cast(widget)->setMask(path.toFillPolygon().toPolygon()); +// m_blurHelper->update(const_cast(widget)); + + m_blurHelper->enableBlurBehind(const_cast(widget), true, Phantom::DefaultFrame_Radius); } painter->restore(); @@ -4481,7 +4483,7 @@ void BaseStyle::polish(QWidget *widget) if (qobject_cast(widget)) { widget->setAttribute(Qt::WA_TranslucentBackground, true); - m_blurHelper->registerWidget(widget); + // m_blurHelper->registerWidget(widget); } if (widget->inherits("QTipLabel") || widget->inherits("QComboBoxPrivateContainer")) { @@ -4510,7 +4512,7 @@ void BaseStyle::unpolish(QWidget *widget) if (qobject_cast(widget)) { widget->setAttribute(Qt::WA_TranslucentBackground, false); - m_blurHelper->unregisterWidget(widget); + // m_blurHelper->unregisterWidget(widget); } if (widget->inherits("QTipLabel")) { diff --git a/widgetstyle/blurhelper.cpp b/widgetstyle/blurhelper.cpp index edb757f..89997fb 100644 --- a/widgetstyle/blurhelper.cpp +++ b/widgetstyle/blurhelper.cpp @@ -36,6 +36,8 @@ // Qt #include +#include +#include #include #include #include @@ -110,3 +112,41 @@ void BlurHelper::update(QWidget *widget) const widget->update(); } } + +void BlurHelper::enableBlurBehind(QWidget *widget, bool enable, qreal windowRadius) +{ + if (!widget) + return; + + xcb_connection_t *c = QX11Info::connection(); + if (!c) + return; + + const QByteArray effectName = QByteArrayLiteral("_KDE_NET_WM_BLUR_BEHIND_REGION"); + xcb_intern_atom_cookie_t atomCookie = xcb_intern_atom_unchecked(c, false, effectName.length(), effectName.constData()); + QScopedPointer atom(xcb_intern_atom_reply(c, atomCookie, nullptr)); + if (!atom) + return; + + if (enable) { + qreal devicePixelRatio = widget->screen()->devicePixelRatio(); + QPainterPath path; + path.addRoundedRect(QRectF(QPoint(0, 0), widget->size() * devicePixelRatio), + windowRadius * devicePixelRatio, + windowRadius * devicePixelRatio); + QVector data; + for (const QPolygonF &polygon : path.toFillPolygons()) { + QRegion region = polygon.toPolygon(); + for (auto i = region.begin(); i != region.end(); ++i) { + data << i->x() << i->y() << i->width() << i->height(); + } + } + + xcb_change_property(c, XCB_PROP_MODE_REPLACE, widget->winId(), + atom->atom, XCB_ATOM_CARDINAL, + 32, data.size(), data.constData()); + + } else { + xcb_delete_property(c, widget->winId(), atom->atom); + } +} diff --git a/widgetstyle/blurhelper.h b/widgetstyle/blurhelper.h index fe69749..99b45b9 100644 --- a/widgetstyle/blurhelper.h +++ b/widgetstyle/blurhelper.h @@ -46,6 +46,8 @@ public: void update(QWidget *) const; + void enableBlurBehind(QWidget *widget, bool enable = true, qreal windowRadius = 0.0); + protected: void addEventFilter(QObject *object) { object->removeEventFilter(this);