From 158d060b5f083a30261b2b27e01e120d81d6aae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sun, 24 Mar 2013 19:13:00 +0100 Subject: [PATCH] turn "ignore geometry" forcerule into a setrule and btw. replace legacy "ignoreposition" by "ignoregeometry" this will allow to use "apply initially" as "force" used to act (ignore position on placement) and "force" to prevent clients from reconfiguring themselves (to not break a tabgroup or to just not be annoying) BUG: 311720 CCBUG: 252314 REVIEW: 109691 FIXED-IN: 4.11 --- geometry.cpp | 3 +++ kcmkwin/kwinrules/ruleswidget.cpp | 10 +++++----- kcmkwin/kwinrules/ruleswidget.h | 2 +- kcmkwin/kwinrules/ruleswidgetbase.ui | 27 +++++++++++++++++++++------ manage.cpp | 2 +- rules.cpp | 27 ++++++++------------------- rules.h | 10 ++++------ 7 files changed, 43 insertions(+), 38 deletions(-) diff --git a/geometry.cpp b/geometry.cpp index ad8352e438..fdb112bdc9 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -1604,6 +1604,9 @@ const QPoint Client::calculateGravitation(bool invert, int gravity) const void Client::configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool) { + if (rules()->checkIgnoreGeometry(false)) + return; // user said: "FU!" + // "maximized" is a user setting -> we do not allow the client to resize itself // away from this & against the users explicit wish kDebug(1212) << this << bool(value_mask & (CWX|CWWidth|CWY|CWHeight)) << diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 4a3159e210..04ff275277 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -111,7 +111,7 @@ RulesWidget::RulesWidget(QWidget* parent) // workarounds tab SETUP(fsplevel, force); SETUP(type, force); - SETUP(ignoreposition, force); + SETUP(ignoregeometry, set); SETUP(minsize, force); SETUP(maxsize, force); SETUP(strictgeometry, force); @@ -186,7 +186,7 @@ void RulesWidget::updateEnableshortcut() // workarounds tab UPDATE_ENABLE_SLOT(fsplevel) UPDATE_ENABLE_SLOT(type) -UPDATE_ENABLE_SLOT(ignoreposition) +UPDATE_ENABLE_SLOT(ignoregeometry) UPDATE_ENABLE_SLOT(minsize) UPDATE_ENABLE_SLOT(maxsize) UPDATE_ENABLE_SLOT(strictgeometry) @@ -454,7 +454,7 @@ void RulesWidget::setRules(Rules* rules) LINEEDIT_SET_RULE(shortcut,); COMBOBOX_FORCE_RULE(fsplevel,); COMBOBOX_FORCE_RULE(type, typeToCombo); - CHECKBOX_FORCE_RULE(ignoreposition,); + CHECKBOX_SET_RULE(ignoregeometry,); LINEEDIT_FORCE_RULE(minsize, sizeToStr); LINEEDIT_FORCE_RULE(maxsize, sizeToStr); CHECKBOX_FORCE_RULE(strictgeometry,); @@ -551,7 +551,7 @@ Rules* RulesWidget::rules() const LINEEDIT_SET_RULE(shortcut,); COMBOBOX_FORCE_RULE(fsplevel,); COMBOBOX_FORCE_RULE(type, comboToType); - CHECKBOX_FORCE_RULE(ignoreposition,); + CHECKBOX_SET_RULE(ignoregeometry,); LINEEDIT_FORCE_RULE(minsize, strToSize); LINEEDIT_FORCE_RULE(maxsize, strToSize); CHECKBOX_FORCE_RULE(strictgeometry,); @@ -671,7 +671,7 @@ void RulesWidget::prefillUnusedValues(const KWindowInfo& info) //LINEEDIT_PREFILL( shortcut, ); //COMBOBOX_PREFILL( fsplevel, ); COMBOBOX_PREFILL(type, typeToCombo, info.windowType(SUPPORTED_MANAGED_WINDOW_TYPES_MASK)); - //CHECKBOX_PREFILL( ignoreposition, ); + //CHECKBOX_PREFILL( ignoregeometry, ); LINEEDIT_PREFILL(minsize, sizeToStr, info.frameGeometry().size()); LINEEDIT_PREFILL(maxsize, sizeToStr, info.frameGeometry().size()); //CHECKBOX_PREFILL( strictgeometry, ); diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index 585c4feded..4392ac93e1 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -82,7 +82,7 @@ private slots: // workarounds tab void updateEnablefsplevel(); void updateEnabletype(); - void updateEnableignoreposition(); + void updateEnableignoregeometry(); void updateEnableminsize(); void updateEnablemaxsize(); void updateEnablestrictgeometry(); diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 60c781ed91..bfa9891328 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -14,7 +14,7 @@ - 0 + 1 @@ -1114,7 +1114,7 @@ - + Windows can ask to appear in a certain position. By default this overrides the placement strategy @@ -1127,7 +1127,7 @@ to unconditionally popup in the middle of your screen. - + false @@ -1136,11 +1136,26 @@ to unconditionally popup in the middle of your screen. Do Not Affect + + + Apply Initially + + + + + Remember + + Force + + + Apply Now + + Force Temporarily @@ -1149,7 +1164,7 @@ to unconditionally popup in the middle of your screen. - + false @@ -2518,8 +2533,8 @@ but this may sometimes fail or superact. enable_placement rule_placement placement - enable_ignoreposition - rule_ignoreposition + enable_ignoregeometry + rule_ignoregeometry enable_minsize rule_minsize minsize diff --git a/manage.cpp b/manage.cpp index c1af7dd7b6..0a55feeb3c 100644 --- a/manage.cpp +++ b/manage.cpp @@ -281,7 +281,7 @@ bool Client::manage(Window w, bool isMapped) ; // Force using placement policy else usePosition = true; - if (!rules()->checkIgnoreGeometry(!usePosition)) { + if (!rules()->checkIgnoreGeometry(!usePosition, true)) { if (((xSizeHint.flags & PPosition)) || (xSizeHint.flags & USPosition)) { placementDone = true; diff --git a/rules.cpp b/rules.cpp index 8a1edc8531..2beca526d7 100644 --- a/rules.cpp +++ b/rules.cpp @@ -52,7 +52,7 @@ Rules::Rules() , maxsizerule(UnusedForceRule) , opacityactiverule(UnusedForceRule) , opacityinactiverule(UnusedForceRule) - , ignorepositionrule(UnusedForceRule) + , ignoregeometryrule(UnusedSetRule) , desktoprule(UnusedSetRule) , screenrule(UnusedSetRule) , activityrule(UnusedSetRule) @@ -158,7 +158,7 @@ void Rules::readFromCfg(const KConfigGroup& cfg) READ_FORCE_RULE(opacityinactive, , 0); if (opacityinactive < 0 || opacityinactive > 100) opacityinactive = 100; - READ_FORCE_RULE(ignoreposition, , false); + READ_SET_RULE(ignoregeometry, , false); READ_SET_RULE(desktop, , 0); READ_SET_RULE(screen, , 0); READ_SET_RULE(activity, , QString()); @@ -248,7 +248,7 @@ void Rules::write(KConfigGroup& cfg) const WRITE_FORCE_RULE(maxsize,); WRITE_FORCE_RULE(opacityactive,); WRITE_FORCE_RULE(opacityinactive,); - WRITE_FORCE_RULE(ignoreposition,); + WRITE_SET_RULE(ignoregeometry,); WRITE_SET_RULE(desktop,); WRITE_SET_RULE(screen,); WRITE_SET_RULE(activity,); @@ -290,7 +290,7 @@ bool Rules::isEmpty() const && maxsizerule == UnusedForceRule && opacityactiverule == UnusedForceRule && opacityinactiverule == UnusedForceRule - && ignorepositionrule == UnusedForceRule + && ignoregeometryrule == UnusedSetRule && desktoprule == UnusedSetRule && screenrule == UnusedSetRule && activityrule == UnusedSetRule @@ -582,13 +582,7 @@ APPLY_FORCE_RULE(minsize, MinSize, QSize) APPLY_FORCE_RULE(maxsize, MaxSize, QSize) APPLY_FORCE_RULE(opacityactive, OpacityActive, int) APPLY_FORCE_RULE(opacityinactive, OpacityInactive, int) -APPLY_FORCE_RULE(ignoreposition, IgnorePosition, bool) - -// the cfg. entry needs to stay named the say for backwards compatibility -bool Rules::applyIgnoreGeometry(bool& ignore) const -{ - return applyIgnorePosition(ignore); -} +APPLY_RULE(ignoregeometry, IgnoreGeometry, bool) APPLY_RULE(desktop, Desktop, int) APPLY_RULE(screen, Screen, int) @@ -680,7 +674,7 @@ void Rules::discardUsed(bool withdrawn) DISCARD_USED_FORCE_RULE(maxsize); DISCARD_USED_FORCE_RULE(opacityactive); DISCARD_USED_FORCE_RULE(opacityinactive); - DISCARD_USED_FORCE_RULE(ignoreposition); + DISCARD_USED_SET_RULE(ignoregeometry); DISCARD_USED_SET_RULE(desktop); DISCARD_USED_SET_RULE(screen); DISCARD_USED_SET_RULE(activity); @@ -790,12 +784,7 @@ CHECK_FORCE_RULE(MinSize, QSize) CHECK_FORCE_RULE(MaxSize, QSize) CHECK_FORCE_RULE(OpacityActive, int) CHECK_FORCE_RULE(OpacityInactive, int) -CHECK_FORCE_RULE(IgnorePosition, bool) - -bool WindowRules::checkIgnoreGeometry(bool ignore) const -{ - return checkIgnorePosition(ignore); -} +CHECK_RULE(IgnoreGeometry, bool) CHECK_RULE(Desktop, int) CHECK_RULE(Activity, QString) @@ -867,7 +856,7 @@ void Client::applyWindowRules() if (geom != orig_geom) setGeometry(geom); // MinSize, MaxSize handled by Geometry - // IgnorePosition + // IgnoreGeometry setDesktop(desktop()); workspace()->sendClientToScreen(this, screen()); setOnActivities(activities()); diff --git a/rules.h b/rules.h index 2299dd8593..a4893b5fc0 100644 --- a/rules.h +++ b/rules.h @@ -61,7 +61,7 @@ public: QSize checkMaxSize(QSize s) const; int checkOpacityActive(int s) const; int checkOpacityInactive(int s) const; - bool checkIgnoreGeometry(bool ignore) const; + bool checkIgnoreGeometry(bool ignore, bool init = false) const; int checkDesktop(int desktop, bool init = false) const; int checkScreen(int screen, bool init = false) const; QString checkActivity(QString activity, bool init = false) const; @@ -86,7 +86,6 @@ public: bool checkStrictGeometry(bool strict) const; QString checkShortcut(QString s, bool init = false) const; bool checkDisableGlobalShortcuts(bool disable) const; - bool checkIgnorePosition(bool ignore) const; // obsolete private: MaximizeMode checkMaximizeVert(MaximizeMode mode, bool init) const; MaximizeMode checkMaximizeHoriz(MaximizeMode mode, bool init) const; @@ -127,7 +126,7 @@ public: bool applyMaxSize(QSize& s) const; bool applyOpacityActive(int& s) const; bool applyOpacityInactive(int& s) const; - bool applyIgnoreGeometry(bool& ignore) const; + bool applyIgnoreGeometry(bool& ignore, bool init) const; bool applyDesktop(int& desktop, bool init) const; bool applyScreen(int& desktop, bool init) const; bool applyActivity(QString& activity, bool init) const; @@ -153,7 +152,6 @@ public: bool applyStrictGeometry(bool& strict) const; bool applyShortcut(QString& shortcut, bool init) const; bool applyDisableGlobalShortcuts(bool& disable) const; - bool applyIgnorePosition(bool& ignore) const; // obsolete private: #endif bool matchType(NET::WindowType match_type) const; @@ -223,8 +221,8 @@ private: ForceRule opacityactiverule; int opacityinactive; ForceRule opacityinactiverule; - bool ignoreposition; - ForceRule ignorepositionrule; + bool ignoregeometry; + SetRule ignoregeometryrule; int desktop; SetRule desktoprule; int screen;