Revert "优化圆角特效"

This reverts commit 8e0b5e44a5.
This commit is contained in:
MouseZhang 2022-12-13 11:11:40 +08:00
parent 6c586d763d
commit 681d25be61
6 changed files with 69 additions and 33 deletions

View File

@ -132,9 +132,6 @@ public:
QRect iconGeometry() const override {
return QRect();
}
uint32_t quickTileMode() const override{
return 0;
}
bool isDesktop() const override {
return false;
}

View File

@ -2005,15 +2005,6 @@ NET::WindowType EffectWindowImpl::windowType() const
return toplevel->windowType();
}
uint32_t EffectWindowImpl::quickTileMode() const
{
AbstractClient* client = qobject_cast<AbstractClient *>(toplevel);
if (client) {
return client->quickTileMode();
}
return 0;
}
#define CLIENT_HELPER( rettype, prototype, propertyname, defaultValue ) \
rettype EffectWindowImpl::prototype ( ) const \
{ \

View File

@ -445,7 +445,6 @@ public:
bool isUserResize() const override;
QRect iconGeometry() const override;
uint32_t quickTileMode() const override;
bool isDesktop() const override;
bool isDock() const override;
bool isToolbar() const override;

View File

@ -139,26 +139,68 @@ void UBREffect::prePaintWindow(KWin::EffectWindow *w, KWin::WindowPrePaintData &
return KWin::Effect::prePaintWindow(w, data, time);
}
bool UBREffect::shouldUBR(KWin::EffectWindow *w, int mask)
{
if ((m_radius < MIN_BORDER_RADIUS)
|| (!KWin::effects->isOpenGLCompositing())
|| (!w->isManaged())
|| (!w->isPaintingEnabled() || ((mask & PAINT_WINDOW_LANCZOS)))
|| (w->data(IgnoreUBR).isValid())
|| (!w->data(IsUKUIDecoration).toBool() && !w->hasDecoration())
|| (w->isFullScreen())
|| (w->windowType() != NET::WindowType::Normal && !w->isDialog() && !w->isUtility())
|| (w->quickTileMode())) {
return false;
}
return true;
}
void UBREffect::drawWindow(KWin::EffectWindow *w, int mask, const QRegion &region, KWin::WindowPaintData &data)
{
if (!shouldUBR(w, mask))
if (m_radius < MIN_BORDER_RADIUS) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (this->ignoreWindowType[w->windowType()]) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (w->data(IgnoreUBR).isValid()) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
bool isUKUIDecoration = false;
if (!w->data(IsUKUIDecoration).toBool() && !w->hasDecoration()) {
// recheck wayland window
if (w->surface()) {
// FIXME: quads has been dropped.
// for (auto quad : data.quads) {
// if (quad.type() != KWin::WindowQuadType::WindowQuadContents) {
isUKUIDecoration = true;
w->setData(IsUKUIDecoration, true);
// break;
// }
// }
if (!isUKUIDecoration) {
w->setData(IgnoreUBR, true);
}
}
if (!w->data(IsUKUIDecoration).toBool() && !w->hasDecoration())
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (!KWin::effects->isOpenGLCompositing()) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (!w->isPaintingEnabled() || ((mask & PAINT_WINDOW_LANCZOS))) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (!w->surface()) {
// wayland window doesn't has such window type
if (w->windowType() != NET::WindowType::Normal && !w->isDialog() && !w->isUtility()) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
// wayland window is always unmanaged
if (!w->isManaged()) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
}
if ((mask & PAINT_WINDOW_TRANSFORMED) && !(mask & PAINT_SCREEN_TRANSFORMED)) {
//return KWin::Effect::drawWindow(w, mask, region, data);
}
if (maximizedWindows.contains(w)) {
return KWin::Effect::drawWindow(w, mask, region, data);
}
if (!w->hasAlpha()) {
//return KWin::Effect::drawWindow(w, mask, region, data);

View File

@ -53,8 +53,16 @@ protected:
private:
KWin::GLShader *m_ubrShader = nullptr;
int m_radius;
bool shouldUBR(KWin::EffectWindow* w, int mask);
std::unordered_map<int, int> ignoreWindowType = {
{NET::Dock, 1},
{NET::Menu, 1},
{NET::DropdownMenu, 1},
{NET::Tooltip, 1},
{NET::ComboBox, 1},
{NET::Splash, 1},
{NET::Desktop, 1},
{NET::Notification, 1}
};
public Q_SLOTS:
void themeUpdate(int themeId);

View File

@ -2336,7 +2336,6 @@ public:
virtual QString windowRole() const = 0;
virtual const EffectWindowGroup* group() const = 0;
virtual uint32_t quickTileMode() const = 0;
/**
* Returns whether the window is a desktop background window (the one with wallpaper).
* See _NET_WM_WINDOW_TYPE_DESKTOP at https://standards.freedesktop.org/wm-spec/wm-spec-latest.html .