Correct code style of Client fullscreen control
Summary: As a preperational step for future changes obey the code styling guide in Client fullscreen functionality. No functional changes. Test Plan: Manually, autotests pass. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: zzag, graesslin, kwin Tags: #kwin Maniphest Tasks: T11098 Differential Revision: https://phabricator.kde.org/D18153
This commit is contained in:
parent
1347610bb9
commit
4f7800a56a
5 changed files with 47 additions and 31 deletions
|
@ -140,7 +140,7 @@ Client::Client()
|
|||
|
||||
shade_mode = ShadeNone;
|
||||
deleting = false;
|
||||
fullscreen_mode = FullScreenNone;
|
||||
m_fullscreenMode = FullScreenNone;
|
||||
hidden = false;
|
||||
noborder = false;
|
||||
app_noborder = false;
|
||||
|
|
8
client.h
8
client.h
|
@ -148,10 +148,10 @@ public:
|
|||
bool isFullScreen() const override;
|
||||
bool userCanSetFullScreen() const override;
|
||||
QRect geometryFSRestore() const {
|
||||
return geom_fs_restore; // Only for session saving
|
||||
return geom_fs_restore; // only for session saving
|
||||
}
|
||||
int fullScreenMode() const {
|
||||
return fullscreen_mode; // only for session saving
|
||||
return m_fullscreenMode; // only for session saving
|
||||
}
|
||||
|
||||
bool userNoBorder() const;
|
||||
|
@ -520,7 +520,7 @@ private:
|
|||
FullScreenNormal,
|
||||
FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop)
|
||||
};
|
||||
FullScreenMode fullscreen_mode;
|
||||
FullScreenMode m_fullscreenMode;
|
||||
MaximizeMode max_mode;
|
||||
QRect geom_restore;
|
||||
QRect geom_fs_restore;
|
||||
|
@ -632,7 +632,7 @@ inline MaximizeMode Client::maximizeMode() const
|
|||
|
||||
inline bool Client::isFullScreen() const
|
||||
{
|
||||
return fullscreen_mode != FullScreenNone;
|
||||
return m_fullscreenMode != FullScreenNone;
|
||||
}
|
||||
|
||||
inline bool Client::hasNETSupport() const
|
||||
|
|
|
@ -675,7 +675,7 @@ void Client::configureRequestEvent(xcb_configure_request_event_t *e)
|
|||
if (isResize() || isMove())
|
||||
return; // we have better things to do right now
|
||||
|
||||
if (fullscreen_mode == FullScreenNormal) { // refuse resizing of fullscreen windows
|
||||
if (m_fullscreenMode == FullScreenNormal) { // refuse resizing of fullscreen windows
|
||||
// but allow resizing fullscreen hacks in order to let them cancel fullscreen mode
|
||||
sendSyntheticConfigureNotify();
|
||||
return;
|
||||
|
|
61
geometry.cpp
61
geometry.cpp
|
@ -2448,61 +2448,76 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
|
|||
|
||||
bool Client::userCanSetFullScreen() const
|
||||
{
|
||||
if (fullscreen_mode == FullScreenHack)
|
||||
if (m_fullscreenMode == FullScreenHack) {
|
||||
return false;
|
||||
if (!isFullScreenable(false))
|
||||
}
|
||||
if (!isFullScreenable(false)) {
|
||||
return false;
|
||||
}
|
||||
return isNormalWindow() || isDialog();
|
||||
}
|
||||
|
||||
void Client::setFullScreen(bool set, bool user)
|
||||
{
|
||||
if (!isFullScreen() && !set)
|
||||
const bool wasFullscreen = isFullScreen();
|
||||
if (!wasFullscreen && !set) {
|
||||
return;
|
||||
if (fullscreen_mode == FullScreenHack)
|
||||
}
|
||||
if (m_fullscreenMode == FullScreenHack) {
|
||||
return;
|
||||
if (user && !userCanSetFullScreen())
|
||||
}
|
||||
if (user && !userCanSetFullScreen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
set = rules()->checkFullScreen(set && !isSpecialWindow());
|
||||
setShade(ShadeNone);
|
||||
bool was_fs = isFullScreen();
|
||||
if (was_fs)
|
||||
|
||||
if (wasFullscreen) {
|
||||
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event
|
||||
else
|
||||
} else {
|
||||
geom_fs_restore = geometry();
|
||||
fullscreen_mode = set ? FullScreenNormal : FullScreenNone;
|
||||
if (was_fs == isFullScreen())
|
||||
}
|
||||
|
||||
m_fullscreenMode = set ? FullScreenNormal : FullScreenNone;
|
||||
if (wasFullscreen == isFullScreen()) {
|
||||
return;
|
||||
}
|
||||
if (set) {
|
||||
untab();
|
||||
workspace()->raiseClient(this);
|
||||
}
|
||||
|
||||
StackingUpdatesBlocker blocker1(workspace());
|
||||
GeometryUpdatesBlocker blocker2(this);
|
||||
workspace()->updateClientLayer(this); // active fullscreens get different layer
|
||||
|
||||
info->setState(isFullScreen() ? NET::FullScreen : NET::States(0), NET::FullScreen);
|
||||
updateDecoration(false, false);
|
||||
|
||||
if (isFullScreen()) {
|
||||
if (info->fullscreenMonitors().isSet())
|
||||
if (info->fullscreenMonitors().isSet()) {
|
||||
setGeometry(fullscreenMonitorsArea(info->fullscreenMonitors()));
|
||||
else
|
||||
} else {
|
||||
setGeometry(workspace()->clientArea(FullScreenArea, this));
|
||||
}
|
||||
else {
|
||||
}
|
||||
} else {
|
||||
if (!geom_fs_restore.isNull()) {
|
||||
int currentScreen = screen();
|
||||
const int currentScreen = screen();
|
||||
setGeometry(QRect(geom_fs_restore.topLeft(), adjustedSize(geom_fs_restore.size())));
|
||||
if( currentScreen != screen())
|
||||
if(currentScreen != screen()) {
|
||||
workspace()->sendClientToScreen( this, currentScreen );
|
||||
// TODO isShaded() ?
|
||||
}
|
||||
// TODO isShaded() ?
|
||||
} else {
|
||||
// does this ever happen?
|
||||
setGeometry(workspace()->clientArea(MaximizeArea, this));
|
||||
}
|
||||
}
|
||||
updateWindowRules(Rules::Fullscreen|Rules::Position|Rules::Size);
|
||||
|
||||
if (was_fs != isFullScreen()) {
|
||||
updateWindowRules(Rules::Fullscreen | Rules::Position | Rules::Size);
|
||||
|
||||
if (wasFullscreen != isFullScreen()) {
|
||||
emit clientFullScreenSet(this, set, user);
|
||||
emit fullScreenChanged();
|
||||
}
|
||||
|
@ -2568,8 +2583,8 @@ int Client::checkFullScreenHack(const QRect& geom) const
|
|||
void Client::updateFullScreenHack(const QRect& geom)
|
||||
{
|
||||
int type = checkFullScreenHack(geom);
|
||||
if (fullscreen_mode == FullScreenNone && type != 0) {
|
||||
fullscreen_mode = FullScreenHack;
|
||||
if (m_fullscreenMode == FullScreenNone && type != 0) {
|
||||
m_fullscreenMode = FullScreenHack;
|
||||
updateDecoration(false, false);
|
||||
QRect geom;
|
||||
if (rules()->checkStrictGeometry(false)) {
|
||||
|
@ -2580,8 +2595,8 @@ void Client::updateFullScreenHack(const QRect& geom)
|
|||
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
|
||||
setGeometry(geom);
|
||||
emit fullScreenChanged();
|
||||
} else if (fullscreen_mode == FullScreenHack && type == 0) {
|
||||
fullscreen_mode = FullScreenNone;
|
||||
} else if (m_fullscreenMode == FullScreenHack && type == 0) {
|
||||
m_fullscreenMode = FullScreenNone;
|
||||
updateDecoration(false, false);
|
||||
// whoever called this must setup correct geometry
|
||||
emit fullScreenChanged();
|
||||
|
|
|
@ -281,7 +281,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
|||
}
|
||||
|
||||
if (int type = checkFullScreenHack(geom)) {
|
||||
fullscreen_mode = FullScreenHack;
|
||||
m_fullscreenMode = FullScreenHack;
|
||||
if (rules()->checkStrictGeometry(false)) {
|
||||
geom = type == 2 // 1 = It's xinerama-aware fullscreen hack, 2 = It's full area
|
||||
? workspace()->clientArea(FullArea, geom.center(), desktop())
|
||||
|
@ -566,8 +566,9 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
|||
demandAttention();
|
||||
if (info->state() & NET::Modal)
|
||||
setModal(true);
|
||||
if (fullscreen_mode != FullScreenHack)
|
||||
if (m_fullscreenMode != FullScreenHack) {
|
||||
setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false);
|
||||
}
|
||||
}
|
||||
|
||||
updateAllowedActions(true);
|
||||
|
|
Loading…
Reference in a new issue