[effects] Improve interaction between Glide and SlidingPopups effect
Summary: The glide effect tried to not animate any window the SlidingPopups effect animates. But it detected that in a very crude way. It announced the KDE_SLIDE atom and checked for windows having that property set. This has a few disadvantages: * KWindowEffects::isEffectAvailable gets confused as an effect announces support for SlidingPopups which doesn't provide SlidingPopups * The approach can only work for X11 windows * The approach causes X11 usage in the ctor With this change the GlideEffect implements a slot for EffectsHandler::windowDataChanged to detect that the SlidingPopupsEffect grabbed the window. The X11 atom interaction is removed. Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3296
This commit is contained in:
parent
9e4a858285
commit
40ad7ef4e9
2 changed files with 19 additions and 14 deletions
|
@ -35,23 +35,17 @@ static const int IsGlideWindow = 0x22A982D4;
|
|||
|
||||
GlideEffect::GlideEffect()
|
||||
: Effect()
|
||||
, m_atom(QByteArrayLiteral("_KDE_SLIDE"))
|
||||
{
|
||||
if (m_atom.isValid()) {
|
||||
effects->registerPropertyType( m_atom, true );
|
||||
}
|
||||
reconfigure(ReconfigureAll);
|
||||
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), this, SLOT(slotWindowAdded(KWin::EffectWindow*)));
|
||||
connect(effects, SIGNAL(windowClosed(KWin::EffectWindow*)), this, SLOT(slotWindowClosed(KWin::EffectWindow*)));
|
||||
connect(effects, SIGNAL(windowDeleted(KWin::EffectWindow*)), this, SLOT(slotWindowDeleted(KWin::EffectWindow*)));
|
||||
|
||||
|
||||
connect(effects, &EffectsHandler::windowDataChanged, this, &GlideEffect::cancelWindowGrab);
|
||||
}
|
||||
|
||||
GlideEffect::~GlideEffect()
|
||||
{
|
||||
if (m_atom.isValid()) {
|
||||
effects->registerPropertyType( m_atom, false );
|
||||
}
|
||||
}
|
||||
GlideEffect::~GlideEffect() = default;
|
||||
|
||||
bool GlideEffect::supported()
|
||||
{
|
||||
|
@ -214,8 +208,6 @@ bool GlideEffect::isGlideWindow(EffectWindow* w)
|
|||
return false;
|
||||
if (w->data(IsGlideWindow).toBool())
|
||||
return true;
|
||||
if (m_atom.isValid() && !w->readProperty( m_atom, m_atom, 32 ).isNull())
|
||||
return false;
|
||||
if (w->hasDecoration())
|
||||
return true;
|
||||
if (!w->isManaged() || w->isMenu() || w->isNotification() || w->isDesktop() ||
|
||||
|
@ -229,6 +221,20 @@ bool GlideEffect::isActive() const
|
|||
return !windows.isEmpty();
|
||||
}
|
||||
|
||||
void GlideEffect::cancelWindowGrab(EffectWindow *w, int grabRole)
|
||||
{
|
||||
if (grabRole != WindowAddedGrabRole && grabRole != WindowClosedGrabRole) {
|
||||
return;
|
||||
}
|
||||
if (!w->data(IsGlideWindow).toBool()) {
|
||||
return;
|
||||
}
|
||||
if (w->data(grabRole).value<void*>() != this) {
|
||||
windows.remove(w);
|
||||
w->setData(IsGlideWindow, false);
|
||||
}
|
||||
}
|
||||
|
||||
GlideEffect::WindowInfo::WindowInfo()
|
||||
: deleted(false)
|
||||
, added(false)
|
||||
|
|
|
@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#define KWIN_GLIDE_H
|
||||
|
||||
#include <kwineffects.h>
|
||||
#include <xcbutils.h>
|
||||
|
||||
class QTimeLine;
|
||||
|
||||
|
@ -75,7 +74,7 @@ private:
|
|||
void glideIn(EffectWindow* w, WindowPaintData& data, const InfoHash::const_iterator &info);
|
||||
void glideOut(EffectWindow* w, WindowPaintData& data, const InfoHash::const_iterator &info);
|
||||
bool isGlideWindow(EffectWindow* w);
|
||||
Xcb::Atom m_atom;
|
||||
void cancelWindowGrab(EffectWindow *w, int grabRole);
|
||||
InfoHash windows;
|
||||
float duration;
|
||||
int angle;
|
||||
|
|
Loading…
Reference in a new issue