Introduce property "visible" on EffectWindow
This property can be used to check whether a window is currently visible to the user, that is: * not minimized * on the current desktop * on current activity This is a common need for various effects. REVIEW: 108341
This commit is contained in:
parent
2781f240b6
commit
819b474a79
3 changed files with 23 additions and 5 deletions
|
@ -148,11 +148,7 @@ void FallApartEffect::slotWindowClosed(EffectWindow* c)
|
||||||
{
|
{
|
||||||
if (!isRealWindow(c))
|
if (!isRealWindow(c))
|
||||||
return;
|
return;
|
||||||
if (c->isMinimized())
|
if (!c->isVisible())
|
||||||
return;
|
|
||||||
if (!c->isOnCurrentDesktop())
|
|
||||||
return;
|
|
||||||
if (!c->isOnCurrentActivity())
|
|
||||||
return;
|
return;
|
||||||
const void* e = c->data(WindowClosedGrabRole).value<void*>();
|
const void* e = c->data(WindowClosedGrabRole).value<void*>();
|
||||||
if (e && e != this)
|
if (e && e != this)
|
||||||
|
|
|
@ -818,6 +818,13 @@ bool EffectWindow::hasDecoration() const
|
||||||
return contentsRect() != QRect(0, 0, width(), height());
|
return contentsRect() != QRect(0, 0, width(), height());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EffectWindow::isVisible() const
|
||||||
|
{
|
||||||
|
return !isMinimized()
|
||||||
|
&& isOnCurrentDesktop()
|
||||||
|
&& isOnCurrentActivity();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
// EffectWindowGroup
|
// EffectWindowGroup
|
||||||
|
|
|
@ -1360,6 +1360,16 @@ class KWIN_EXPORT EffectWindow : public QObject
|
||||||
* @since 4.10
|
* @since 4.10
|
||||||
**/
|
**/
|
||||||
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
||||||
|
/**
|
||||||
|
* Whether the window is currently visible to the user, that is:
|
||||||
|
* <ul>
|
||||||
|
* <li>Not minimized</li>
|
||||||
|
* <li>On current desktop</li>
|
||||||
|
* <li>On current activity</li>
|
||||||
|
* </ul>
|
||||||
|
* @since 4.11
|
||||||
|
**/
|
||||||
|
Q_PROPERTY(bool visible READ isVisible)
|
||||||
public:
|
public:
|
||||||
/** Flags explaining why painting should be disabled */
|
/** Flags explaining why painting should be disabled */
|
||||||
enum {
|
enum {
|
||||||
|
@ -1577,6 +1587,11 @@ public:
|
||||||
|
|
||||||
bool isCurrentTab() const;
|
bool isCurrentTab() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 4.11
|
||||||
|
**/
|
||||||
|
bool isVisible() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be used to by effects to store arbitrary data in the EffectWindow.
|
* Can be used to by effects to store arbitrary data in the EffectWindow.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue