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;
|
shade_mode = ShadeNone;
|
||||||
deleting = false;
|
deleting = false;
|
||||||
fullscreen_mode = FullScreenNone;
|
m_fullscreenMode = FullScreenNone;
|
||||||
hidden = false;
|
hidden = false;
|
||||||
noborder = false;
|
noborder = false;
|
||||||
app_noborder = false;
|
app_noborder = false;
|
||||||
|
|
8
client.h
8
client.h
|
@ -148,10 +148,10 @@ public:
|
||||||
bool isFullScreen() const override;
|
bool isFullScreen() const override;
|
||||||
bool userCanSetFullScreen() const override;
|
bool userCanSetFullScreen() const override;
|
||||||
QRect geometryFSRestore() const {
|
QRect geometryFSRestore() const {
|
||||||
return geom_fs_restore; // Only for session saving
|
return geom_fs_restore; // only for session saving
|
||||||
}
|
}
|
||||||
int fullScreenMode() const {
|
int fullScreenMode() const {
|
||||||
return fullscreen_mode; // only for session saving
|
return m_fullscreenMode; // only for session saving
|
||||||
}
|
}
|
||||||
|
|
||||||
bool userNoBorder() const;
|
bool userNoBorder() const;
|
||||||
|
@ -520,7 +520,7 @@ private:
|
||||||
FullScreenNormal,
|
FullScreenNormal,
|
||||||
FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop)
|
FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop)
|
||||||
};
|
};
|
||||||
FullScreenMode fullscreen_mode;
|
FullScreenMode m_fullscreenMode;
|
||||||
MaximizeMode max_mode;
|
MaximizeMode max_mode;
|
||||||
QRect geom_restore;
|
QRect geom_restore;
|
||||||
QRect geom_fs_restore;
|
QRect geom_fs_restore;
|
||||||
|
@ -632,7 +632,7 @@ inline MaximizeMode Client::maximizeMode() const
|
||||||
|
|
||||||
inline bool Client::isFullScreen() const
|
inline bool Client::isFullScreen() const
|
||||||
{
|
{
|
||||||
return fullscreen_mode != FullScreenNone;
|
return m_fullscreenMode != FullScreenNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Client::hasNETSupport() const
|
inline bool Client::hasNETSupport() const
|
||||||
|
|
|
@ -675,7 +675,7 @@ void Client::configureRequestEvent(xcb_configure_request_event_t *e)
|
||||||
if (isResize() || isMove())
|
if (isResize() || isMove())
|
||||||
return; // we have better things to do right now
|
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
|
// but allow resizing fullscreen hacks in order to let them cancel fullscreen mode
|
||||||
sendSyntheticConfigureNotify();
|
sendSyntheticConfigureNotify();
|
||||||
return;
|
return;
|
||||||
|
|
61
geometry.cpp
61
geometry.cpp
|
@ -2448,61 +2448,76 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
|
||||||
|
|
||||||
bool Client::userCanSetFullScreen() const
|
bool Client::userCanSetFullScreen() const
|
||||||
{
|
{
|
||||||
if (fullscreen_mode == FullScreenHack)
|
if (m_fullscreenMode == FullScreenHack) {
|
||||||
return false;
|
return false;
|
||||||
if (!isFullScreenable(false))
|
}
|
||||||
|
if (!isFullScreenable(false)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return isNormalWindow() || isDialog();
|
return isNormalWindow() || isDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setFullScreen(bool set, bool user)
|
void Client::setFullScreen(bool set, bool user)
|
||||||
{
|
{
|
||||||
if (!isFullScreen() && !set)
|
const bool wasFullscreen = isFullScreen();
|
||||||
|
if (!wasFullscreen && !set) {
|
||||||
return;
|
return;
|
||||||
if (fullscreen_mode == FullScreenHack)
|
}
|
||||||
|
if (m_fullscreenMode == FullScreenHack) {
|
||||||
return;
|
return;
|
||||||
if (user && !userCanSetFullScreen())
|
}
|
||||||
|
if (user && !userCanSetFullScreen()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
set = rules()->checkFullScreen(set && !isSpecialWindow());
|
set = rules()->checkFullScreen(set && !isSpecialWindow());
|
||||||
setShade(ShadeNone);
|
setShade(ShadeNone);
|
||||||
bool was_fs = isFullScreen();
|
|
||||||
if (was_fs)
|
if (wasFullscreen) {
|
||||||
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event
|
workspace()->updateFocusMousePosition(Cursor::pos()); // may cause leave event
|
||||||
else
|
} else {
|
||||||
geom_fs_restore = geometry();
|
geom_fs_restore = geometry();
|
||||||
fullscreen_mode = set ? FullScreenNormal : FullScreenNone;
|
}
|
||||||
if (was_fs == isFullScreen())
|
|
||||||
|
m_fullscreenMode = set ? FullScreenNormal : FullScreenNone;
|
||||||
|
if (wasFullscreen == isFullScreen()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (set) {
|
if (set) {
|
||||||
untab();
|
untab();
|
||||||
workspace()->raiseClient(this);
|
workspace()->raiseClient(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
|
||||||
|
|
||||||
info->setState(isFullScreen() ? NET::FullScreen : NET::States(0), NET::FullScreen);
|
info->setState(isFullScreen() ? NET::FullScreen : NET::States(0), NET::FullScreen);
|
||||||
updateDecoration(false, false);
|
updateDecoration(false, false);
|
||||||
|
|
||||||
if (isFullScreen()) {
|
if (isFullScreen()) {
|
||||||
if (info->fullscreenMonitors().isSet())
|
if (info->fullscreenMonitors().isSet()) {
|
||||||
setGeometry(fullscreenMonitorsArea(info->fullscreenMonitors()));
|
setGeometry(fullscreenMonitorsArea(info->fullscreenMonitors()));
|
||||||
else
|
} else {
|
||||||
setGeometry(workspace()->clientArea(FullScreenArea, this));
|
setGeometry(workspace()->clientArea(FullScreenArea, this));
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
if (!geom_fs_restore.isNull()) {
|
if (!geom_fs_restore.isNull()) {
|
||||||
int currentScreen = screen();
|
const int currentScreen = screen();
|
||||||
setGeometry(QRect(geom_fs_restore.topLeft(), adjustedSize(geom_fs_restore.size())));
|
setGeometry(QRect(geom_fs_restore.topLeft(), adjustedSize(geom_fs_restore.size())));
|
||||||
if( currentScreen != screen())
|
if(currentScreen != screen()) {
|
||||||
workspace()->sendClientToScreen( this, currentScreen );
|
workspace()->sendClientToScreen( this, currentScreen );
|
||||||
// TODO isShaded() ?
|
}
|
||||||
|
// TODO isShaded() ?
|
||||||
} else {
|
} else {
|
||||||
// does this ever happen?
|
// does this ever happen?
|
||||||
setGeometry(workspace()->clientArea(MaximizeArea, this));
|
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 clientFullScreenSet(this, set, user);
|
||||||
emit fullScreenChanged();
|
emit fullScreenChanged();
|
||||||
}
|
}
|
||||||
|
@ -2568,8 +2583,8 @@ int Client::checkFullScreenHack(const QRect& geom) const
|
||||||
void Client::updateFullScreenHack(const QRect& geom)
|
void Client::updateFullScreenHack(const QRect& geom)
|
||||||
{
|
{
|
||||||
int type = checkFullScreenHack(geom);
|
int type = checkFullScreenHack(geom);
|
||||||
if (fullscreen_mode == FullScreenNone && type != 0) {
|
if (m_fullscreenMode == FullScreenNone && type != 0) {
|
||||||
fullscreen_mode = FullScreenHack;
|
m_fullscreenMode = FullScreenHack;
|
||||||
updateDecoration(false, false);
|
updateDecoration(false, false);
|
||||||
QRect geom;
|
QRect geom;
|
||||||
if (rules()->checkStrictGeometry(false)) {
|
if (rules()->checkStrictGeometry(false)) {
|
||||||
|
@ -2580,8 +2595,8 @@ void Client::updateFullScreenHack(const QRect& geom)
|
||||||
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
|
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
|
||||||
setGeometry(geom);
|
setGeometry(geom);
|
||||||
emit fullScreenChanged();
|
emit fullScreenChanged();
|
||||||
} else if (fullscreen_mode == FullScreenHack && type == 0) {
|
} else if (m_fullscreenMode == FullScreenHack && type == 0) {
|
||||||
fullscreen_mode = FullScreenNone;
|
m_fullscreenMode = FullScreenNone;
|
||||||
updateDecoration(false, false);
|
updateDecoration(false, false);
|
||||||
// whoever called this must setup correct geometry
|
// whoever called this must setup correct geometry
|
||||||
emit fullScreenChanged();
|
emit fullScreenChanged();
|
||||||
|
|
|
@ -281,7 +281,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int type = checkFullScreenHack(geom)) {
|
if (int type = checkFullScreenHack(geom)) {
|
||||||
fullscreen_mode = FullScreenHack;
|
m_fullscreenMode = FullScreenHack;
|
||||||
if (rules()->checkStrictGeometry(false)) {
|
if (rules()->checkStrictGeometry(false)) {
|
||||||
geom = type == 2 // 1 = It's xinerama-aware fullscreen hack, 2 = It's full area
|
geom = type == 2 // 1 = It's xinerama-aware fullscreen hack, 2 = It's full area
|
||||||
? workspace()->clientArea(FullArea, geom.center(), desktop())
|
? workspace()->clientArea(FullArea, geom.center(), desktop())
|
||||||
|
@ -566,8 +566,9 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
||||||
demandAttention();
|
demandAttention();
|
||||||
if (info->state() & NET::Modal)
|
if (info->state() & NET::Modal)
|
||||||
setModal(true);
|
setModal(true);
|
||||||
if (fullscreen_mode != FullScreenHack)
|
if (m_fullscreenMode != FullScreenHack) {
|
||||||
setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false);
|
setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAllowedActions(true);
|
updateAllowedActions(true);
|
||||||
|
|
Loading…
Reference in a new issue