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
icc-effect-5.14.5
Thomas Lübking 2013-03-24 19:13:00 +01:00
parent f00ec6ccd5
commit 158d060b5f
7 changed files with 43 additions and 38 deletions

View File

@ -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)) <<

View File

@ -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, );

View File

@ -82,7 +82,7 @@ private slots:
// workarounds tab
void updateEnablefsplevel();
void updateEnabletype();
void updateEnableignoreposition();
void updateEnableignoregeometry();
void updateEnableminsize();
void updateEnablemaxsize();
void updateEnablestrictgeometry();

View File

@ -14,7 +14,7 @@
<item row="0" column="1">
<widget class="QTabWidget" name="tabs">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="TabPage1">
<attribute name="title">
@ -1114,7 +1114,7 @@
</widget>
</item>
<item row="16" column="1" colspan="2">
<widget class="QCheckBox" name="enable_ignoreposition">
<widget class="QCheckBox" name="enable_ignoregeometry">
<property name="toolTip">
<string>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.</string>
</widget>
</item>
<item row="16" column="3">
<widget class="KComboBox" name="rule_ignoreposition">
<widget class="KComboBox" name="rule_ignoregeometry">
<property name="enabled">
<bool>false</bool>
</property>
@ -1136,11 +1136,26 @@ to unconditionally popup in the middle of your screen.</string>
<string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text">
<string>Apply Initially</string>
</property>
</item>
<item>
<property name="text">
<string>Remember</string>
</property>
</item>
<item>
<property name="text">
<string>Force</string>
</property>
</item>
<item>
<property name="text">
<string>Apply Now</string>
</property>
</item>
<item>
<property name="text">
<string>Force Temporarily</string>
@ -1149,7 +1164,7 @@ to unconditionally popup in the middle of your screen.</string>
</widget>
</item>
<item row="16" column="4">
<widget class="YesNoBox" name="ignoreposition" native="true">
<widget class="YesNoBox" name="ignoregeometry" native="true">
<property name="enabled">
<bool>false</bool>
</property>
@ -2518,8 +2533,8 @@ but this may sometimes fail or superact.
<tabstop>enable_placement</tabstop>
<tabstop>rule_placement</tabstop>
<tabstop>placement</tabstop>
<tabstop>enable_ignoreposition</tabstop>
<tabstop>rule_ignoreposition</tabstop>
<tabstop>enable_ignoregeometry</tabstop>
<tabstop>rule_ignoregeometry</tabstop>
<tabstop>enable_minsize</tabstop>
<tabstop>rule_minsize</tabstop>
<tabstop>minsize</tabstop>

View File

@ -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;

View File

@ -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());

10
rules.h
View File

@ -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;