4dcb3c495c
On Wayland, the highlight window effect is not guaranteed to work all the time because it uses the opacity to determine if the animation has completed. This change rewrites the highlight window effect using AnimationEffect API to make it work both on X11 and Wayland. The implementation is based on how the translucency effect works.
61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*
|
|
KWin - the KDE window manager
|
|
This file is part of the KDE project.
|
|
|
|
SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef KWIN_HIGHLIGHTWINDOW_H
|
|
#define KWIN_HIGHLIGHTWINDOW_H
|
|
|
|
#include <kwinanimationeffect.h>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class HighlightWindowEffect : public AnimationEffect
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
HighlightWindowEffect();
|
|
|
|
int requestedEffectChainPosition() const override {
|
|
return 70;
|
|
}
|
|
|
|
bool provides(Feature feature) override;
|
|
bool perform(Feature feature, const QVariantList &arguments) override;
|
|
|
|
public Q_SLOTS:
|
|
void slotWindowAdded(KWin::EffectWindow* w);
|
|
void slotWindowClosed(KWin::EffectWindow *w);
|
|
void slotWindowDeleted(KWin::EffectWindow *w);
|
|
void slotPropertyNotify(KWin::EffectWindow* w, long atom, EffectWindow *addedWindow = nullptr);
|
|
|
|
private:
|
|
void startGhostAnimation(EffectWindow *window, int duration = -1);
|
|
void startHighlightAnimation(EffectWindow *window, int duration = -1);
|
|
void startRevertAnimation(EffectWindow *window);
|
|
|
|
bool isHighlighted(EffectWindow *window) const;
|
|
|
|
void prepareHighlighting();
|
|
void finishHighlighting();
|
|
void highlightWindows(const QVector<KWin::EffectWindow *> &windows);
|
|
|
|
long m_atom;
|
|
QList<EffectWindow *> m_highlightedWindows;
|
|
QHash<EffectWindow *, quint64> m_animations;
|
|
QEasingCurve m_easingCurve;
|
|
int m_fadeDuration;
|
|
EffectWindow *m_monitorWindow;
|
|
QList<WId> m_highlightedIds;
|
|
float m_ghostOpacity = 0.15;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
#endif
|