mirror of https://gitee.com/openkylin/kwin.git
优化圆角特效
This commit is contained in:
parent
9a586e5ef9
commit
8e0b5e44a5
|
@ -132,6 +132,9 @@ public:
|
|||
QRect iconGeometry() const override {
|
||||
return QRect();
|
||||
}
|
||||
uint32_t quickTileMode() const override{
|
||||
return 0;
|
||||
}
|
||||
bool isDesktop() const override {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2009,6 +2009,15 @@ 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 \
|
||||
{ \
|
||||
|
|
|
@ -445,6 +445,7 @@ 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;
|
||||
|
|
|
@ -139,68 +139,26 @@ 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 ®ion, KWin::WindowPaintData &data)
|
||||
{
|
||||
if (m_radius < MIN_BORDER_RADIUS) {
|
||||
if (!shouldUBR(w, mask))
|
||||
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);
|
||||
|
|
|
@ -53,16 +53,8 @@ protected:
|
|||
private:
|
||||
KWin::GLShader *m_ubrShader = nullptr;
|
||||
int m_radius;
|
||||
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}
|
||||
};
|
||||
|
||||
bool shouldUBR(KWin::EffectWindow* w, int mask);
|
||||
|
||||
public Q_SLOTS:
|
||||
void themeUpdate(int themeId);
|
||||
|
|
|
@ -2336,6 +2336,7 @@ 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 .
|
||||
|
|
Loading…
Reference in New Issue