Rework ShellClient fullscreen control
Summary: The ShellClient::setFullScreen method was a direct copy of the Client version. Straighten out the function logic now and align with modern coding style. In short we check: 1. what the manual override window rule wants, 2. if there is a change at all with this, 3. if such a change is possible. And do: 4. (un-)set the fullscreen, 5. emit the changed signal. Test Plan: Manually, autotests pass. Reviewers: #kwin Subscribers: zzag, kwin Tags: #kwin Maniphest Tasks: T11098 Differential Revision: https://phabricator.kde.org/D18132
This commit is contained in:
parent
3e1b616642
commit
1347610bb9
1 changed files with 18 additions and 13 deletions
|
@ -945,14 +945,20 @@ bool ShellClient::isFullScreenable() const
|
||||||
|
|
||||||
void ShellClient::setFullScreen(bool set, bool user)
|
void ShellClient::setFullScreen(bool set, bool user)
|
||||||
{
|
{
|
||||||
if (!isFullScreen() && !set)
|
set = rules()->checkFullScreen(set);
|
||||||
|
|
||||||
|
const bool wasFullscreen = isFullScreen();
|
||||||
|
if (wasFullscreen == set) {
|
||||||
return;
|
return;
|
||||||
if (user && !userCanSetFullScreen())
|
}
|
||||||
|
if (isSpecialWindow()) {
|
||||||
return;
|
return;
|
||||||
set = rules()->checkFullScreen(set && !isSpecialWindow());
|
}
|
||||||
setShade(ShadeNone);
|
if (user && !userCanSetFullScreen()) {
|
||||||
bool was_fs = isFullScreen();
|
return;
|
||||||
if (was_fs) {
|
}
|
||||||
|
|
||||||
|
if (wasFullscreen) {
|
||||||
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event
|
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event
|
||||||
} else {
|
} else {
|
||||||
// in shell surface, maximise mode and fullscreen are exclusive
|
// in shell surface, maximise mode and fullscreen are exclusive
|
||||||
|
@ -964,8 +970,7 @@ void ShellClient::setFullScreen(bool set, bool user)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_fullScreen = set;
|
m_fullScreen = set;
|
||||||
if (was_fs == isFullScreen())
|
|
||||||
return;
|
|
||||||
if (set) {
|
if (set) {
|
||||||
untab();
|
untab();
|
||||||
workspace()->raiseClient(this);
|
workspace()->raiseClient(this);
|
||||||
|
@ -973,9 +978,11 @@ void ShellClient::setFullScreen(bool set, bool user)
|
||||||
RequestGeometryBlocker requestBlocker(this);
|
RequestGeometryBlocker requestBlocker(this);
|
||||||
StackingUpdatesBlocker blocker1(workspace());
|
StackingUpdatesBlocker blocker1(workspace());
|
||||||
GeometryUpdatesBlocker blocker2(this);
|
GeometryUpdatesBlocker blocker2(this);
|
||||||
|
|
||||||
workspace()->updateClientLayer(this); // active fullscreens get different layer
|
workspace()->updateClientLayer(this); // active fullscreens get different layer
|
||||||
updateDecoration(false, false);
|
updateDecoration(false, false);
|
||||||
if (isFullScreen()) {
|
|
||||||
|
if (set) {
|
||||||
setGeometry(workspace()->clientArea(FullScreenArea, this));
|
setGeometry(workspace()->clientArea(FullScreenArea, this));
|
||||||
} else {
|
} else {
|
||||||
if (m_geomFsRestore.isValid()) {
|
if (m_geomFsRestore.isValid()) {
|
||||||
|
@ -989,11 +996,9 @@ void ShellClient::setFullScreen(bool set, bool user)
|
||||||
setGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0)));
|
setGeometry(QRect(workspace()->clientArea(PlacementArea, this).topLeft(), QSize(0, 0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size);
|
|
||||||
|
|
||||||
if (was_fs != isFullScreen()) {
|
updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size);
|
||||||
emit fullScreenChanged();
|
emit fullScreenChanged();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellClient::setNoBorder(bool set)
|
void ShellClient::setNoBorder(bool set)
|
||||||
|
|
Loading…
Reference in a new issue