[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
icc-effect-5.17.5
Vlad Zagorodniy 2018-10-15 10:09:27 +03:00
parent 77e3bbef7e
commit 597445e2a6
4 changed files with 23 additions and 0 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -20,5 +20,8 @@
<entry name="DimByGroup" type="Bool">
<default>true</default>
</entry>
<entry name="DimFullScreen" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>

View File

@ -69,6 +69,13 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_DimFullScreen">
<property name="text">
<string>Fullscreen windows</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>