[libkwineffects] Save value of the managed property during construction of EffectWindow
Summary: When windowClosed signal is emitted, effects can't distinguish managed windows from unmanaged windows(e.g. combo box popups, popup menus, etc). This leads to dirty hacks like IsXXXWindow. Also, there's a big chance that such hack can introduce more bugs and overall this makes harder to write/maintain effects. This change proposes to save value of managed property during construction of EffectWindow. So, its value is preserved with Deleted. Test Plan: Manually. Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: graesslin, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13690
This commit is contained in:
parent
95a2c3bf76
commit
f977e60850
2 changed files with 33 additions and 2 deletions
|
@ -767,9 +767,32 @@ EffectsHandler* effects = nullptr;
|
|||
// EffectWindow
|
||||
//****************************************
|
||||
|
||||
class Q_DECL_HIDDEN EffectWindow::Private
|
||||
{
|
||||
public:
|
||||
Private(EffectWindow *q);
|
||||
|
||||
EffectWindow *q;
|
||||
bool managed = false;
|
||||
};
|
||||
|
||||
EffectWindow::Private::Private(EffectWindow *q)
|
||||
: q(q)
|
||||
{
|
||||
}
|
||||
|
||||
EffectWindow::EffectWindow(QObject *parent)
|
||||
: QObject(parent)
|
||||
, d(new Private(this))
|
||||
{
|
||||
// Deleted windows are not managed. So, when windowClosed signal is
|
||||
// emitted, effects can't distinguish managed windows from unmanaged
|
||||
// windows(e.g. combo box popups, popup menus, etc). Save value of the
|
||||
// managed property during construction of EffectWindow. At that time,
|
||||
// parent can be Client, ShellClient, or Unmanaged. So, later on, when
|
||||
// an instance of Deleted becomes parent of the EffectWindow, effects
|
||||
// can still figure out whether it is/was a managed window.
|
||||
d->managed = parent->property("managed").value<bool>();
|
||||
}
|
||||
|
||||
EffectWindow::~EffectWindow()
|
||||
|
@ -810,7 +833,6 @@ WINDOW_HELPER(bool, isNotification, "notification")
|
|||
WINDOW_HELPER(bool, isOnScreenDisplay, "onScreenDisplay")
|
||||
WINDOW_HELPER(bool, isComboBox, "comboBox")
|
||||
WINDOW_HELPER(bool, isDNDIcon, "dndIcon")
|
||||
WINDOW_HELPER(bool, isManaged, "managed")
|
||||
WINDOW_HELPER(bool, isDeleted, "deleted")
|
||||
WINDOW_HELPER(bool, hasOwnShape, "shaped")
|
||||
WINDOW_HELPER(QString, windowRole, "windowRole")
|
||||
|
@ -963,6 +985,11 @@ bool EffectWindow::isVisible() const
|
|||
&& isOnCurrentActivity();
|
||||
}
|
||||
|
||||
bool EffectWindow::isManaged() const
|
||||
{
|
||||
return d->managed;
|
||||
}
|
||||
|
||||
|
||||
//****************************************
|
||||
// EffectWindowGroup
|
||||
|
|
|
@ -186,7 +186,7 @@ X-KDE-Library=kwin4_effect_cooleffect
|
|||
|
||||
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
|
||||
#define KWIN_EFFECT_API_VERSION_MAJOR 0
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 224
|
||||
#define KWIN_EFFECT_API_VERSION_MINOR 225
|
||||
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
|
||||
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
|
||||
|
||||
|
@ -2242,6 +2242,10 @@ public:
|
|||
* @since 4.11
|
||||
*/
|
||||
virtual void unreferencePreviousWindowPixmap() = 0;
|
||||
|
||||
private:
|
||||
class Private;
|
||||
QScopedPointer<Private> d;
|
||||
};
|
||||
|
||||
class KWINEFFECTS_EXPORT EffectWindowGroup
|
||||
|
|
Loading…
Reference in a new issue