From 597445e2a677ce0dccfb5c4b583cf7ecb2326472 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Mon, 15 Oct 2018 10:09:27 +0300 Subject: [PATCH] [effects/diminactive] Add option to exclude fullscreen windows from dimming Summary: Such an option would be useful for people that are used to watch videos in the fullscreen mode. By default, we still dim fullscreen windows because watching videos in fullscreen mode is not the only one use-case. One could have a text editor in fullscreen mode on one screen and Konsole on another screen. In that case, it would be desired to dim the text editor if the latter is active. Also, because we don't have stats of how the fullscreen mode is used by KDE Plasma users. BUG: 399822 FIXED-IN: 5.15.0 Test Plan: * Unchecked the "Fullscreen windows" checkbox; * Opened Konsole; * Opened Firefox in the fullscreen mode; * Pressed Alt+Tab; * (Firefox stayed bright) Reviewers: #kwin, #plasma, davidedmundson Reviewed By: #kwin, #plasma, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16216 --- effects/diminactive/diminactive.cpp | 5 +++++ effects/diminactive/diminactive.h | 8 ++++++++ effects/diminactive/diminactive.kcfg | 3 +++ effects/diminactive/diminactive_config.ui | 7 +++++++ 4 files changed, 23 insertions(+) diff --git a/effects/diminactive/diminactive.cpp b/effects/diminactive/diminactive.cpp index 69ba653117..a6f4f05b53 100644 --- a/effects/diminactive/diminactive.cpp +++ b/effects/diminactive/diminactive.cpp @@ -75,6 +75,7 @@ void DimInactiveEffect::reconfigure(ReconfigureFlags flags) m_dimDesktop = DimInactiveConfig::dimDesktop(); m_dimKeepAbove = DimInactiveConfig::dimKeepAbove(); m_dimByGroup = DimInactiveConfig::dimByGroup(); + m_dimFullScreen = DimInactiveConfig::dimFullScreen(); // Need to reset m_activeWindow becase canDimWindow returns false // if m_activeWindow is equal to effects->activeWindow(). @@ -197,6 +198,10 @@ bool DimInactiveEffect::canDimWindow(const EffectWindow *w) const return false; } + if (w->isFullScreen() && !m_dimFullScreen) { + return false; + } + if (!w->isManaged()) { return false; } diff --git a/effects/diminactive/diminactive.h b/effects/diminactive/diminactive.h index 1af62f778a..4aef26e26d 100644 --- a/effects/diminactive/diminactive.h +++ b/effects/diminactive/diminactive.h @@ -37,6 +37,7 @@ class DimInactiveEffect : public Effect Q_PROPERTY(bool dimDesktop READ dimDesktop) Q_PROPERTY(bool dimKeepAbove READ dimKeepAbove) Q_PROPERTY(bool dimByGroup READ dimByGroup) + Q_PROPERTY(bool dimFullScreen READ dimFullScreen) public: DimInactiveEffect(); @@ -56,6 +57,7 @@ public: bool dimDesktop() const; bool dimKeepAbove() const; bool dimByGroup() const; + bool dimFullScreen() const; private Q_SLOTS: void windowActivated(EffectWindow *w); @@ -78,6 +80,7 @@ private: bool m_dimDesktop; bool m_dimKeepAbove; bool m_dimByGroup; + bool m_dimFullScreen; EffectWindow *m_activeWindow; const EffectWindowGroup *m_activeWindowGroup; @@ -125,6 +128,11 @@ inline bool DimInactiveEffect::dimByGroup() const return m_dimByGroup; } +inline bool DimInactiveEffect::dimFullScreen() const +{ + return m_dimFullScreen; +} + } // namespace KWin #endif diff --git a/effects/diminactive/diminactive.kcfg b/effects/diminactive/diminactive.kcfg index f1f32fe627..ebad90c9eb 100644 --- a/effects/diminactive/diminactive.kcfg +++ b/effects/diminactive/diminactive.kcfg @@ -20,5 +20,8 @@ true + + true + diff --git a/effects/diminactive/diminactive_config.ui b/effects/diminactive/diminactive_config.ui index 19f7ff1019..f81ed44f43 100644 --- a/effects/diminactive/diminactive_config.ui +++ b/effects/diminactive/diminactive_config.ui @@ -69,6 +69,13 @@ + + + + Fullscreen windows + + +