File indexing completed on 2024-06-16 05:05:41
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2009 Lucas Murray <lmurray@undefinedfire.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "effect/animationeffect.h" 0013 0014 namespace KWin 0015 { 0016 0017 class HighlightWindowEffect : public AnimationEffect 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 HighlightWindowEffect(); 0023 ~HighlightWindowEffect() override; 0024 0025 int requestedEffectChainPosition() const override 0026 { 0027 return 70; 0028 } 0029 0030 bool provides(Feature feature) override; 0031 bool perform(Feature feature, const QVariantList &arguments) override; 0032 Q_SCRIPTABLE void highlightWindows(const QStringList &windows); 0033 0034 public Q_SLOTS: 0035 void slotWindowAdded(KWin::EffectWindow *w); 0036 void slotWindowClosed(KWin::EffectWindow *w); 0037 void slotWindowDeleted(KWin::EffectWindow *w); 0038 void slotPropertyNotify(KWin::EffectWindow *w, long atom, EffectWindow *addedWindow = nullptr); 0039 0040 private: 0041 quint64 startGhostAnimation(EffectWindow *window); 0042 quint64 startHighlightAnimation(EffectWindow *window); 0043 void startRevertAnimation(EffectWindow *window); 0044 0045 bool isHighlighted(EffectWindow *window) const; 0046 0047 void prepareHighlighting(); 0048 void finishHighlighting(); 0049 void highlightWindows(const QList<KWin::EffectWindow *> &windows); 0050 0051 long m_atom; 0052 QList<EffectWindow *> m_highlightedWindows; 0053 QHash<EffectWindow *, quint64> m_animations; 0054 QEasingCurve m_easingCurve; 0055 int m_fadeDuration; 0056 EffectWindow *m_monitorWindow; 0057 QList<WId> m_highlightedIds; 0058 float m_ghostOpacity = 0; 0059 }; 0060 0061 } // namespace