Remove Client fullscreen hack

Summary:
This hack seems to be deactivated by default nowadays and I did not find an
option in the KCMs to activate it. Git blame shows some last commits from
around 2012 to the functions, but they only deal with code style.

Also even if it would be enabled, in light of Wayland we don't want some
roque XWayland client go bonkers via this hack.

This patch removes the code path in order to decrease complexity and ease
future changes to the fullscreen handling overall.

Test Plan: Manually and autotests pass.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, graesslin, kwin

Tags: #kwin

Maniphest Tasks: T11098

Differential Revision: https://phabricator.kde.org/D18157
icc-effect-5.17.5
Roman Gilg 2019-01-10 16:01:42 +01:00
parent 4f2a8711a4
commit b0d1689722
7 changed files with 8 additions and 111 deletions

View File

@ -596,18 +596,10 @@ bool Client::userNoBorder() const
}
bool Client::isFullScreenable() const
{
return isFullScreenable(false);
}
bool Client::isFullScreenable(bool fullscreenHack) const
{
if (!rules()->checkFullScreen(true)) {
return false;
}
if (fullscreenHack) {
return isNormalWindow();
}
if (rules()->checkStrictGeometry(true)) {
// check geometry constraints (rule to obey is set)
const QRect fsarea = workspace()->clientArea(FullScreenArea, this);

View File

@ -348,8 +348,6 @@ private:
Client* findAutogroupCandidate() const;
bool isFullScreenable(bool fullscreenHack) const;
protected:
virtual void debug(QDebug& stream) const;
void addDamage(const QRegion &damage) override;
@ -410,8 +408,6 @@ private:
void updateAllowedActions(bool force = false);
QRect fullscreenMonitorsArea(NETFullscreenMonitors topology) const;
void changeMaximize(bool horizontal, bool vertical, bool adjust) override;
int checkFullScreenHack(const QRect& geom) const; // 0 - None, 1 - One xinerama screen, 2 - Full area
void updateFullScreenHack(const QRect& geom);
void getWmNormalHints();
void getMotifHints();
void getIcons();
@ -514,13 +510,12 @@ private:
uint app_noborder : 1; ///< App requested no border via window type, shape extension, etc.
uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
bool blocks_compositing;
// DON'T reorder - Saved to config files !!!
enum FullScreenMode {
FullScreenNone,
FullScreenNormal,
FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop)
};
FullScreenMode m_fullscreenMode;
FullScreenNormal
} m_fullscreenMode;
MaximizeMode max_mode;
QRect geom_restore;
QRect geom_fs_restore;

View File

@ -1736,7 +1736,6 @@ void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, in
move(new_pos);
plainResize(ns);
setGeometry(QRect(calculateGravitation(false, gravity), size()));
updateFullScreenHack(QRect(new_pos, QSize(nw, nh)));
QRect area = workspace()->clientArea(WorkArea, this);
if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen()
&& area.contains(origClientGeometry))
@ -1764,7 +1763,6 @@ void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, in
QRect origClientGeometry(pos() + clientPos(), clientSize());
GeometryUpdatesBlocker blocker(this);
resizeWithChecks(ns, xcb_gravity_t(gravity));
updateFullScreenHack(QRect(calculateGravitation(true, m_geometryHints.windowGravity()), QSize(nw, nh)));
if (!from_tool && (!isSpecialWindow() || isToolbar()) && !isFullScreen()) {
// try to keep the window in its xinerama screen if possible,
// if that fails at least keep it visible somewhere
@ -2448,10 +2446,7 @@ void Client::changeMaximize(bool vertical, bool horizontal, bool adjust)
bool Client::userCanSetFullScreen() const
{
if (m_fullscreenMode == FullScreenHack) {
return false;
}
if (!isFullScreenable(false)) {
if (!isFullScreenable()) {
return false;
}
return isNormalWindow() || isDialog();
@ -2463,9 +2458,6 @@ void Client::setFullScreen(bool set, bool user)
if (!wasFullscreen && !set) {
return;
}
if (m_fullscreenMode == FullScreenHack) {
return;
}
if (user && !userCanSetFullScreen()) {
return;
}
@ -2565,46 +2557,6 @@ QRect Client::fullscreenMonitorsArea(NETFullscreenMonitors requestedTopology) co
return total;
}
int Client::checkFullScreenHack(const QRect& geom) const
{
if (!options->isLegacyFullscreenSupport())
return 0;
// if it's noborder window, and has size of one screen or the whole desktop geometry, it's fullscreen hack
if (noBorder() && app_noborder && isFullScreenable(true)) {
if (geom.size() == workspace()->clientArea(FullArea, geom.center(), desktop()).size())
return 2; // full area fullscreen hack
if (geom.size() == workspace()->clientArea(ScreenArea, geom.center(), desktop()).size())
return 1; // xinerama-aware fullscreen hack
}
return 0;
}
void Client::updateFullScreenHack(const QRect& geom)
{
int type = checkFullScreenHack(geom);
if (m_fullscreenMode == FullScreenNone && type != 0) {
m_fullscreenMode = FullScreenHack;
updateDecoration(false, false);
QRect geom;
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())
: workspace()->clientArea(ScreenArea, geom.center(), desktop());
} else
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
setGeometry(geom);
emit fullScreenChanged();
} else if (m_fullscreenMode == FullScreenHack && type == 0) {
m_fullscreenMode = FullScreenNone;
updateDecoration(false, false);
// whoever called this must setup correct geometry
emit fullScreenChanged();
}
StackingUpdatesBlocker blocker(workspace());
workspace()->updateClientLayer(this); // active fullscreens get different layer
}
static GeometryTip* geometryTip = 0;
void Client::positionGeometryTip()

View File

@ -108,9 +108,6 @@
<entry name="RollOverDesktops" type="Bool">
<default>true</default>
</entry>
<entry name="LegacyFullscreenSupport" type="Bool">
<default>false</default>
</entry>
<entry name="FocusStealingPreventionLevel" type="Int">
<default>1</default>
<min>0</min>

View File

@ -280,17 +280,6 @@ bool Client::manage(xcb_window_t w, bool isMapped)
area = workspace()->clientArea(PlacementArea, screens()->geometry(screen).center(), desktop());
}
if (int type = checkFullScreenHack(geom)) {
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())
: workspace()->clientArea(ScreenArea, geom.center(), desktop());
} else
geom = workspace()->clientArea(FullScreenArea, geom.center(), desktop());
placementDone = true;
}
if (isDesktop())
// KWin doesn't manage desktop windows
placementDone = true;
@ -532,9 +521,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
if (session->maximized != MaximizeRestore) {
maximize(MaximizeMode(session->maximized));
}
if (session->fullscreen == FullScreenHack)
; // Nothing, this should be already set again above
else if (session->fullscreen != FullScreenNone) {
if (session->fullscreen != FullScreenNone) {
setFullScreen(true, false);
geom_fs_restore = session->fsrestore;
}
@ -566,9 +553,8 @@ bool Client::manage(xcb_window_t w, bool isMapped)
demandAttention();
if (info->state() & NET::Modal)
setModal(true);
if (m_fullscreenMode != FullScreenHack) {
setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false);
}
setFullScreen(rules()->checkFullScreen(info->state() & NET::FullScreen, !isMapped), false);
}
updateAllowedActions(true);

View File

@ -104,7 +104,6 @@ Options::Options(QObject *parent)
, m_snapOnlyWhenOverlapping(false)
, m_rollOverDesktops(false)
, m_focusStealingPreventionLevel(0)
, m_legacyFullscreenSupport(false)
, m_killPingTimeout(0)
, m_hideUtilityWindowsForInactive(false)
, m_inactiveTabsSkipTaskbar(false)
@ -326,15 +325,6 @@ void Options::setFocusStealingPreventionLevel(int focusStealingPreventionLevel)
emit focusStealingPreventionLevelChanged();
}
void Options::setLegacyFullscreenSupport(bool legacyFullscreenSupport)
{
if (m_legacyFullscreenSupport == legacyFullscreenSupport) {
return;
}
m_legacyFullscreenSupport = legacyFullscreenSupport;
emit legacyFullscreenSupportChanged();
}
void Options::setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick)
{
if (OpTitlebarDblClick == operationTitlebarDblClick) {
@ -847,7 +837,6 @@ void Options::syncFromKcfgc()
setNextFocusPrefersMouse(m_settings->nextFocusPrefersMouse());
setSeparateScreenFocus(m_settings->separateScreenFocus());
setRollOverDesktops(m_settings->rollOverDesktops());
setLegacyFullscreenSupport(m_settings->legacyFullscreenSupport());
setFocusStealingPreventionLevel(m_settings->focusStealingPreventionLevel());
#ifdef KWIN_BUILD_DECORATIONS

View File

@ -111,10 +111,6 @@ class KWIN_EXPORT Options : public QObject
* 0 - 4 , see Workspace::allowClientActivation()
**/
Q_PROPERTY(int focusStealingPreventionLevel READ focusStealingPreventionLevel WRITE setFocusStealingPreventionLevel NOTIFY focusStealingPreventionLevelChanged)
/**
* Support legacy fullscreen windows hack: borderless non-netwm windows with screen geometry.
**/
Q_PROPERTY(bool legacyFullscreenSupport READ isLegacyFullscreenSupport WRITE setLegacyFullscreenSupport NOTIFY legacyFullscreenSupportChanged)
Q_PROPERTY(KWin::Options::WindowOperation operationTitlebarDblClick READ operationTitlebarDblClick WRITE setOperationTitlebarDblClick NOTIFY operationTitlebarDblClickChanged)
Q_PROPERTY(KWin::Options::WindowOperation operationMaxButtonLeftClick READ operationMaxButtonLeftClick WRITE setOperationMaxButtonLeftClick NOTIFY operationMaxButtonLeftClickChanged)
Q_PROPERTY(KWin::Options::WindowOperation operationMaxButtonMiddleClick READ operationMaxButtonMiddleClick WRITE setOperationMaxButtonMiddleClick NOTIFY operationMaxButtonMiddleClickChanged)
@ -342,13 +338,6 @@ public:
return m_focusStealingPreventionLevel;
}
/**
* Support legacy fullscreen windows hack: borderless non-netwm windows with screen geometry.
**/
bool isLegacyFullscreenSupport() const {
return m_legacyFullscreenSupport;
}
enum WindowOperation {
MaximizeOp = 5000,
RestoreOp,
@ -626,7 +615,6 @@ public:
void setSnapOnlyWhenOverlapping(bool snapOnlyWhenOverlapping);
void setRollOverDesktops(bool rollOverDesktops);
void setFocusStealingPreventionLevel(int focusStealingPreventionLevel);
void setLegacyFullscreenSupport(bool legacyFullscreenSupport);
void setOperationTitlebarDblClick(WindowOperation operationTitlebarDblClick);
void setOperationMaxButtonLeftClick(WindowOperation op);
void setOperationMaxButtonRightClick(WindowOperation op);
@ -813,7 +801,6 @@ Q_SIGNALS:
void snapOnlyWhenOverlappingChanged();
void rollOverDesktopsChanged(bool enabled);
void focusStealingPreventionLevelChanged();
void legacyFullscreenSupportChanged();
void operationTitlebarDblClickChanged();
void operationMaxButtonLeftClickChanged();
void operationMaxButtonRightClickChanged();
@ -880,7 +867,6 @@ private:
bool m_snapOnlyWhenOverlapping;
bool m_rollOverDesktops;
int m_focusStealingPreventionLevel;
bool m_legacyFullscreenSupport;
int m_killPingTimeout;
bool m_hideUtilityWindowsForInactive;
bool m_inactiveTabsSkipTaskbar;