aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lübking <thomas.luebking@gmail.com>2012-08-24 16:48:50 (GMT)
committerThomas Lübking <thomas.luebking@gmail.com>2012-09-19 18:21:43 (GMT)
commitd24e9054916312e45ccf82c35f7c57a302528b04 (patch)
tree2617898c1e76073a6db937170fcc698717f8bdcb
parent59027e766cac421e20ddc1a55d5336b382bf8984 (diff)
add screen rule
-rw-r--r--kwin/geometry.cpp9
-rw-r--r--kwin/kcmkwin/kwinrules/ruleswidget.cpp8
-rw-r--r--kwin/kcmkwin/kwinrules/ruleswidget.h3
-rw-r--r--kwin/kcmkwin/kwinrules/ruleswidgetbase.ui676
-rw-r--r--kwin/manage.cpp1
-rw-r--r--kwin/rules.cpp26
-rw-r--r--kwin/rules.h6
-rw-r--r--kwin/workspace.cpp1
8 files changed, 438 insertions, 292 deletions
diff --git a/kwin/geometry.cpp b/kwin/geometry.cpp
index 3dbc2f1..d4c9451 100644
--- a/kwin/geometry.cpp
+++ b/kwin/geometry.cpp
@@ -2607,7 +2607,6 @@ static ElectricBorder electricBorderFromMode(QuickTileMode mode)
void Client::finishMoveResize(bool cancel)
{
const bool wasResize = isResize(); // store across leaveMoveResize
- const bool wasMove = isMove();
leaveMoveResize();
if (cancel)
@@ -2623,8 +2622,12 @@ void Client::finishMoveResize(bool cancel)
}
setGeometry(moveResizeGeom);
}
- if (screen() != moveResizeStartScreen && maximizeMode() != MaximizeRestore)
- checkWorkspacePosition();
+ const int newScreen = screen();
+ if (newScreen != moveResizeStartScreen) {
+ workspace()->sendClientToScreen(this, newScreen); // checks rule validity
+ if (maximizeMode() != MaximizeRestore)
+ checkWorkspacePosition();
+ }
if (isElectricBorderMaximizing()) {
setQuickTileMode(electricMode);
diff --git a/kwin/kcmkwin/kwinrules/ruleswidget.cpp b/kwin/kcmkwin/kwinrules/ruleswidget.cpp
index 5c1ee92..264fc94 100644
--- a/kwin/kcmkwin/kwinrules/ruleswidget.cpp
+++ b/kwin/kcmkwin/kwinrules/ruleswidget.cpp
@@ -85,6 +85,7 @@ RulesWidget::RulesWidget(QWidget* parent)
SETUP(position, set);
SETUP(size, set);
SETUP(desktop, set);
+ SETUP(screen, set);
SETUP(activity, set);
SETUP(maximizehoriz, set);
SETUP(maximizevert, set);
@@ -152,6 +153,7 @@ RulesWidget::RulesWidget(QWidget* parent)
UPDATE_ENABLE_SLOT(position)
UPDATE_ENABLE_SLOT(size)
UPDATE_ENABLE_SLOT(desktop)
+UPDATE_ENABLE_SLOT(screen)
UPDATE_ENABLE_SLOT(activity)
UPDATE_ENABLE_SLOT(maximizehoriz)
UPDATE_ENABLE_SLOT(maximizevert)
@@ -403,6 +405,7 @@ static NET::WindowType comboToType(int val)
#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setChecked, setChecked( false ))
#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setText, setText( "" ))
#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setCurrentIndex, setCurrentIndex( 0 ))
+#define SPINBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, setValue, setValue(0))
#define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setChecked, setChecked( false ))
#define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setText, setText( "" ))
#define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, setCurrentIndex, setCurrentIndex( 0 ))
@@ -440,6 +443,7 @@ void RulesWidget::setRules(Rules* rules)
LINEEDIT_SET_RULE(position, positionToStr);
LINEEDIT_SET_RULE(size, sizeToStr);
COMBOBOX_SET_RULE(desktop, desktopToCombo);
+ SPINBOX_SET_RULE(screen, inc);
COMBOBOX_SET_RULE(activity, activityToCombo);
CHECKBOX_SET_RULE(maximizehoriz,);
CHECKBOX_SET_RULE(maximizevert,);
@@ -475,6 +479,7 @@ void RulesWidget::setRules(Rules* rules)
#undef CHECKBOX_SET_RULE
#undef LINEEDIT_SET_RULE
#undef COMBOBOX_SET_RULE
+#undef SPINBOX_SET_RULE
#undef CHECKBOX_FORCE_RULE
#undef LINEEDIT_FORCE_RULE
#undef COMBOBOX_FORCE_RULE
@@ -492,6 +497,7 @@ void RulesWidget::setRules(Rules* rules)
#define CHECKBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, isChecked )
#define LINEEDIT_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, text )
#define COMBOBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, currentIndex )
+#define SPINBOX_SET_RULE( var, func ) GENERIC_RULE( var, func, Set, set, value)
#define CHECKBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, isChecked )
#define LINEEDIT_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, text )
#define COMBOBOX_FORCE_RULE( var, func ) GENERIC_RULE( var, func, Force, force, currentIndex )
@@ -534,6 +540,7 @@ Rules* RulesWidget::rules() const
LINEEDIT_SET_RULE(position, strToPosition);
LINEEDIT_SET_RULE(size, strToSize);
COMBOBOX_SET_RULE(desktop, comboToDesktop);
+ SPINBOX_SET_RULE(screen, dec);
COMBOBOX_SET_RULE(activity, comboToActivity);
CHECKBOX_SET_RULE(maximizehoriz,);
CHECKBOX_SET_RULE(maximizevert,);
@@ -570,6 +577,7 @@ Rules* RulesWidget::rules() const
#undef CHECKBOX_SET_RULE
#undef LINEEDIT_SET_RULE
#undef COMBOBOX_SET_RULE
+#undef SPINBOX_SET_RULE
#undef CHECKBOX_FORCE_RULE
#undef LINEEDIT_FORCE_RULE
#undef COMBOBOX_FORCE_RULE
diff --git a/kwin/kcmkwin/kwinrules/ruleswidget.h b/kwin/kcmkwin/kwinrules/ruleswidget.h
index 27cf731..a4b5b91 100644
--- a/kwin/kcmkwin/kwinrules/ruleswidget.h
+++ b/kwin/kcmkwin/kwinrules/ruleswidget.h
@@ -57,6 +57,7 @@ private slots:
void updateEnableposition();
void updateEnablesize();
void updateEnabledesktop();
+ void updateEnablescreen();
void updateEnableactivity();
void updateEnablemaximizehoriz();
void updateEnablemaximizevert();
@@ -96,6 +97,8 @@ private:
int activityToCombo(QString d) const;
QString comboToActivity(int val) const;
int comboToTiling(int val) const;
+ int inc(int i) const { return i+1; }
+ int dec(int i) const { return i-1; }
void prefillUnusedValues(const KWindowInfo& info);
DetectDialog* detect_dlg;
bool detect_dlg_ok;
diff --git a/kwin/kcmkwin/kwinrules/ruleswidgetbase.ui b/kwin/kcmkwin/kwinrules/ruleswidgetbase.ui
index 0ff1abd..a1aed46 100644
--- a/kwin/kcmkwin/kwinrules/ruleswidgetbase.ui
+++ b/kwin/kcmkwin/kwinrules/ruleswidgetbase.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>569</width>
- <height>535</height>
+ <width>630</width>
+ <height>580</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@@ -489,7 +489,14 @@
<string>&amp;Size &amp;&amp; Position</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="2">
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="enable_position">
+ <property name="text">
+ <string>&amp;Position</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
<widget class="KComboBox" name="rule_position">
<property name="enabled">
<bool>false</bool>
@@ -526,8 +533,28 @@
</item>
</widget>
</item>
- <item row="7" column="2">
- <widget class="KComboBox" name="rule_maximizevert">
+ <item row="0" column="4">
+ <widget class="KRestrictedLine" name="position">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="placeholderText">
+ <string>x,y</string>
+ </property>
+ <property name="validChars">
+ <string>0123456789-+,xX:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="enable_size">
+ <property name="text">
+ <string>&amp;Size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="KComboBox" name="rule_size">
<property name="enabled">
<bool>false</bool>
</property>
@@ -563,41 +590,35 @@
</item>
</widget>
</item>
- <item row="0" column="3" colspan="2">
- <widget class="KRestrictedLine" name="position">
+ <item row="1" column="4">
+ <widget class="KRestrictedLine" name="size">
<property name="enabled">
<bool>false</bool>
</property>
<property name="placeholderText">
- <string>x,y</string>
+ <string>width,height</string>
</property>
<property name="validChars">
<string>0123456789-+,xX:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="enable_size">
- <property name="text">
- <string>&amp;Size</string>
+ <item row="2" column="1" colspan="4">
+ <widget class="Line" name="line_5">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="1" column="3" colspan="2">
- <widget class="KRestrictedLine" name="size">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="placeholderText">
- <string>width,height</string>
- </property>
- <property name="validChars">
- <string>0123456789-+,xX:</string>
+ <item row="3" column="1">
+ <widget class="QCheckBox" name="enable_maximizehoriz">
+ <property name="text">
+ <string>Maximized &amp;horizontally</string>
</property>
</widget>
</item>
- <item row="28" column="2" rowspan="4">
- <widget class="KComboBox" name="rule_maxsize">
+ <item row="3" column="3">
+ <widget class="KComboBox" name="rule_maximizehoriz">
<property name="enabled">
<bool>false</bool>
</property>
@@ -608,32 +629,47 @@
</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>
</property>
</item>
</widget>
</item>
- <item row="20" column="1">
- <widget class="QCheckBox" name="enable_shade">
- <property name="text">
- <string>Sh&amp;aded</string>
+ <item row="3" column="4">
+ <widget class="YesNoBox" name="maximizehoriz" native="true">
+ <property name="enabled">
+ <bool>false</bool>
</property>
</widget>
</item>
- <item row="18" column="1" rowspan="2">
- <widget class="QCheckBox" name="enable_minimize">
+ <item row="4" column="1">
+ <widget class="QCheckBox" name="enable_maximizevert">
<property name="text">
- <string>M&amp;inimized</string>
+ <string>Maximized &amp;vertically</string>
</property>
</widget>
</item>
- <item row="20" column="2">
- <widget class="KComboBox" name="rule_shade">
+ <item row="4" column="3">
+ <widget class="KComboBox" name="rule_maximizevert">
<property name="enabled">
<bool>false</bool>
</property>
@@ -669,8 +705,42 @@
</item>
</widget>
</item>
- <item row="1" column="2">
- <widget class="KComboBox" name="rule_size">
+ <item row="4" column="4">
+ <widget class="YesNoBox" name="maximizevert" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1" colspan="4">
+ <widget class="Line" name="line_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <spacer name="horizontalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="enable_desktop">
+ <property name="text">
+ <string>&amp;Desktop</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="3">
+ <widget class="KComboBox" name="rule_desktop">
<property name="enabled">
<bool>false</bool>
</property>
@@ -706,8 +776,35 @@
</item>
</widget>
</item>
- <item row="18" column="2" rowspan="2">
- <widget class="KComboBox" name="rule_minimize">
+ <item row="6" column="4">
+ <widget class="KComboBox" name="desktop">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="5">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="7" column="1" colspan="2">
+ <widget class="QCheckBox" name="enable_activity">
+ <property name="text">
+ <string>Activit&amp;y</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="3">
+ <widget class="KComboBox" name="rule_activity">
<property name="enabled">
<bool>false</bool>
</property>
@@ -743,170 +840,141 @@
</item>
</widget>
</item>
- <item row="18" column="3" rowspan="2" colspan="2">
- <widget class="YesNoBox" name="minimize" native="true">
+ <item row="7" column="4">
+ <widget class="KComboBox" name="activity">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="24" column="3" colspan="2">
- <widget class="YesNoBox" name="ignoreposition" native="true">
+ <item row="8" column="4">
+ <widget class="QSpinBox" name="screen">
<property name="enabled">
<bool>false</bool>
</property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
</widget>
</item>
- <item row="22" column="3" rowspan="2" colspan="2">
- <widget class="KComboBox" name="placement">
+ <item row="9" column="1" colspan="4">
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="1" colspan="2">
+ <widget class="QCheckBox" name="enable_fullscreen">
+ <property name="text">
+ <string>&amp;Fullscreen</string>
+ </property>
+ </widget>
+ </item>
+ <item row="10" column="3">
+ <widget class="KComboBox" name="rule_fullscreen">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
- <string>Default</string>
+ <string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text">
- <string>No Placement</string>
+ <string>Apply Initially</string>
</property>
</item>
<item>
<property name="text">
- <string>Smart</string>
+ <string>Remember</string>
</property>
</item>
<item>
<property name="text">
- <string>Maximizing</string>
+ <string>Force</string>
</property>
</item>
<item>
<property name="text">
- <string>Cascade</string>
+ <string>Apply Now</string>
</property>
</item>
<item>
<property name="text">
- <string>Centered</string>
+ <string>Force Temporarily</string>
</property>
</item>
+ </widget>
+ </item>
+ <item row="10" column="4">
+ <widget class="YesNoBox" name="fullscreen" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="1">
+ <widget class="QCheckBox" name="enable_minimize">
+ <property name="text">
+ <string>M&amp;inimized</string>
+ </property>
+ </widget>
+ </item>
+ <item row="11" column="3">
+ <widget class="KComboBox" name="rule_minimize">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<item>
<property name="text">
- <string>Random</string>
+ <string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text">
- <string>Top-Left Corner</string>
+ <string>Apply Initially</string>
</property>
</item>
<item>
<property name="text">
- <string>Under Mouse</string>
+ <string>Remember</string>
</property>
</item>
<item>
<property name="text">
- <string>On Main Window</string>
+ <string>Force</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Apply Now</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Force Temporarily</string>
</property>
</item>
</widget>
</item>
- <item row="28" column="3" rowspan="4" colspan="2">
- <widget class="KRestrictedLine" name="maxsize">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="placeholderText">
- <string>width,height</string>
- </property>
- <property name="validChars">
- <string>0123456789-+,xX:</string>
- </property>
- </widget>
- </item>
- <item row="28" column="1" rowspan="4">
- <widget class="QCheckBox" name="enable_maxsize">
- <property name="text">
- <string>M&amp;aximum size</string>
- </property>
- </widget>
- </item>
- <item row="25" column="1" colspan="4">
- <widget class="Line" name="line_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="23" column="1">
- <widget class="QCheckBox" name="enable_placement">
- <property name="toolTip">
- <string/>
- </property>
- <property name="text">
- <string>Initial p&amp;lacement</string>
- </property>
- </widget>
- </item>
- <item row="20" column="3" colspan="2">
- <widget class="YesNoBox" name="shade" native="true">
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="32" column="3" rowspan="2" colspan="2">
- <widget class="YesNoBox" name="strictgeometry" native="true">
+ <item row="11" column="4">
+ <widget class="YesNoBox" name="minimize" native="true">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="2" column="1" rowspan="3" colspan="4">
- <widget class="Line" name="line_5">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="12" column="0" rowspan="2">
- <spacer name="horizontalSpacer_7">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="32" column="1" rowspan="2">
- <widget class="QCheckBox" name="enable_strictgeometry">
- <property name="toolTip">
- <string>Eg. terminals or video players can ask to keep a certain aspect ratio
-or only grow by values larger than one
-(eg. by the dimensions of one character).
-This may be pointless and the restriction prevents arbitrary dimensions
-like your complete screen area.</string>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
+ <item row="12" column="1" colspan="2">
+ <widget class="QCheckBox" name="enable_shade">
<property name="text">
- <string>Obey geometry restrictions</string>
- </property>
- <property name="shortcut">
- <string/>
+ <string>Sh&amp;aded</string>
</property>
</widget>
</item>
- <item row="26" column="2" rowspan="2">
- <widget class="KComboBox" name="rule_minsize">
+ <item row="12" column="3">
+ <widget class="KComboBox" name="rule_shade">
<property name="enabled">
<bool>false</bool>
</property>
@@ -917,25 +985,47 @@ like your complete screen area.</string>
</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>
</property>
</item>
</widget>
</item>
- <item row="21" column="1" rowspan="2" colspan="4">
+ <item row="12" column="4">
+ <widget class="YesNoBox" name="shade" native="true">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="13" column="1" rowspan="2" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="5" column="2" rowspan="2">
- <widget class="KComboBox" name="rule_maximizehoriz">
+ <item row="14" column="3" rowspan="2">
+ <widget class="KComboBox" name="rule_placement">
<property name="enabled">
<bool>false</bool>
</property>
@@ -946,98 +1036,84 @@ like your complete screen area.</string>
</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>
</property>
</item>
</widget>
</item>
- <item row="11" column="2" rowspan="2">
- <widget class="KComboBox" name="rule_fullscreen">
+ <item row="14" column="4" rowspan="2">
+ <widget class="KComboBox" name="placement">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
- <string>Do Not Affect</string>
+ <string>Default</string>
</property>
</item>
<item>
<property name="text">
- <string>Apply Initially</string>
+ <string>No Placement</string>
</property>
</item>
<item>
<property name="text">
- <string>Remember</string>
+ <string>Smart</string>
</property>
</item>
<item>
<property name="text">
- <string>Force</string>
+ <string>Maximizing</string>
</property>
</item>
<item>
<property name="text">
- <string>Apply Now</string>
+ <string>Cascade</string>
</property>
</item>
<item>
<property name="text">
- <string>Force Temporarily</string>
+ <string>Centered</string>
</property>
</item>
- </widget>
- </item>
- <item row="22" column="2" rowspan="2">
- <widget class="KComboBox" name="rule_placement">
- <property name="enabled">
- <bool>false</bool>
- </property>
<item>
<property name="text">
- <string>Do Not Affect</string>
+ <string>Random</string>
</property>
</item>
<item>
<property name="text">
- <string>Force</string>
+ <string>Top-Left Corner</string>
</property>
</item>
<item>
<property name="text">
- <string>Force Temporarily</string>
+ <string>Under Mouse</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>On Main Window</string>
</property>
</item>
</widget>
</item>
- <item row="7" column="3" colspan="2">
- <widget class="YesNoBox" name="maximizevert" native="true">
- <property name="enabled">
- <bool>false</bool>
+ <item row="15" column="1">
+ <widget class="QCheckBox" name="enable_placement">
+ <property name="toolTip">
+ <string/>
+ </property>
+ <property name="text">
+ <string>Initial p&amp;lacement</string>
</property>
</widget>
</item>
- <item row="24" column="1">
+ <item row="16" column="1" colspan="2">
<widget class="QCheckBox" name="enable_ignoreposition">
<property name="toolTip">
<string>Windows can ask to appear in a certain position.
@@ -1050,49 +1126,44 @@ to unconditionally popup in the middle of your screen.</string>
</property>
</widget>
</item>
- <item row="5" column="1" rowspan="2">
- <widget class="QCheckBox" name="enable_maximizehoriz">
- <property name="text">
- <string>Maximized &amp;horizontally</string>
- </property>
- </widget>
- </item>
- <item row="11" column="1" rowspan="2">
- <widget class="QCheckBox" name="enable_fullscreen">
- <property name="text">
- <string>&amp;Fullscreen</string>
- </property>
- </widget>
- </item>
- <item row="13" column="3" colspan="2">
- <widget class="KComboBox" name="desktop">
+ <item row="16" column="3">
+ <widget class="KComboBox" name="rule_ignoreposition">
<property name="enabled">
<bool>false</bool>
</property>
+ <item>
+ <property name="text">
+ <string>Do Not Affect</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Force</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Force Temporarily</string>
+ </property>
+ </item>
</widget>
</item>
- <item row="11" column="3" rowspan="2" colspan="2">
- <widget class="YesNoBox" name="fullscreen" native="true">
+ <item row="16" column="4">
+ <widget class="YesNoBox" name="ignoreposition" native="true">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="26" column="3" rowspan="2" colspan="2">
- <widget class="KRestrictedLine" name="minsize">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="placeholderText">
- <string>width,height</string>
- </property>
- <property name="validChars">
- <string>0123456789-+,xX:</string>
+ <item row="17" column="1" rowspan="2" colspan="4">
+ <widget class="Line" name="line_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="24" column="2">
- <widget class="KComboBox" name="rule_ignoreposition">
+ <item row="18" column="3" rowspan="2">
+ <widget class="KComboBox" name="rule_minsize">
<property name="enabled">
<bool>false</bool>
</property>
@@ -1113,22 +1184,35 @@ to unconditionally popup in the middle of your screen.</string>
</item>
</widget>
</item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="enable_position">
+ <item row="19" column="1">
+ <widget class="QCheckBox" name="enable_minsize">
<property name="text">
- <string>&amp;Position</string>
+ <string>M&amp;inimum size</string>
</property>
</widget>
</item>
- <item row="5" column="3" rowspan="2" colspan="2">
- <widget class="YesNoBox" name="maximizehoriz" native="true">
+ <item row="19" column="4">
+ <widget class="KRestrictedLine" name="minsize">
<property name="enabled">
<bool>false</bool>
</property>
+ <property name="placeholderText">
+ <string>width,height</string>
+ </property>
+ <property name="validChars">
+ <string>0123456789-+,xX:</string>
+ </property>
</widget>
</item>
- <item row="13" column="2">
- <widget class="KComboBox" name="rule_desktop">
+ <item row="20" column="1">
+ <widget class="QCheckBox" name="enable_maxsize">
+ <property name="text">
+ <string>M&amp;aximum size</string>
+ </property>
+ </widget>
+ </item>
+ <item row="20" column="3">
+ <widget class="KComboBox" name="rule_maxsize">
<property name="enabled">
<bool>false</bool>
</property>
@@ -1139,73 +1223,50 @@ to unconditionally popup in the middle of your screen.</string>
</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>
</property>
</item>
</widget>
</item>
- <item row="7" column="1">
- <widget class="QCheckBox" name="enable_maximizevert">
- <property name="text">
- <string>Maximized &amp;vertically</string>
+ <item row="20" column="4">
+ <widget class="KRestrictedLine" name="maxsize">
+ <property name="enabled">
+ <bool>false</bool>
</property>
- </widget>
- </item>
- <item row="13" column="1">
- <widget class="QCheckBox" name="enable_desktop">
- <property name="text">
- <string>&amp;Desktop</string>
+ <property name="placeholderText">
+ <string>width,height</string>
</property>
- </widget>
- </item>
- <item row="26" column="1" rowspan="2">
- <widget class="QCheckBox" name="enable_minsize">
- <property name="text">
- <string>M&amp;inimum size</string>
+ <property name="validChars">
+ <string>0123456789-+,xX:</string>
</property>
</widget>
</item>
- <item row="12" column="5" rowspan="2">
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <item row="21" column="1" colspan="2">
+ <widget class="QCheckBox" name="enable_strictgeometry">
+ <property name="toolTip">
+ <string>Eg. terminals or video players can ask to keep a certain aspect ratio
+or only grow by values larger than one
+(eg. by the dimensions of one character).
+This may be pointless and the restriction prevents arbitrary dimensions
+like your complete screen area.</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
</property>
- </spacer>
- </item>
- <item row="8" column="1" rowspan="3" colspan="4">
- <widget class="Line" name="line_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <property name="text">
+ <string>Obey geometry restrictions</string>
+ </property>
+ <property name="shortcut">
+ <string/>
</property>
</widget>
</item>
- <item row="32" column="2" rowspan="2">
+ <item row="21" column="3">
<widget class="KComboBox" name="rule_strictgeometry">
<property name="enabled">
<bool>false</bool>
@@ -1227,14 +1288,14 @@ to unconditionally popup in the middle of your screen.</string>
</item>
</widget>
</item>
- <item row="15" column="1" rowspan="3" colspan="4">
- <widget class="Line" name="line_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <item row="21" column="4">
+ <widget class="YesNoBox" name="strictgeometry" native="true">
+ <property name="enabled">
+ <bool>false</bool>
</property>
</widget>
</item>
- <item row="34" column="2">
+ <item row="22" column="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -1250,15 +1311,8 @@ to unconditionally popup in the middle of your screen.</string>
</property>
</spacer>
</item>
- <item row="14" column="1">
- <widget class="QCheckBox" name="enable_activity">
- <property name="text">
- <string>Activit&amp;y</string>
- </property>
- </widget>
- </item>
- <item row="14" column="2">
- <widget class="KComboBox" name="rule_activity">
+ <item row="8" column="3">
+ <widget class="KComboBox" name="rule_screen">
<property name="enabled">
<bool>false</bool>
</property>
@@ -1294,10 +1348,10 @@ to unconditionally popup in the middle of your screen.</string>
</item>
</widget>
</item>
- <item row="14" column="3" colspan="2">
- <widget class="KComboBox" name="activity">
- <property name="enabled">
- <bool>false</bool>
+ <item row="8" column="1" colspan="2">
+ <widget class="QCheckBox" name="enable_screen">
+ <property name="text">
+ <string>Screen</string>
</property>
</widget>
</item>
@@ -2472,7 +2526,9 @@ but this may sometimes fail or superact.
</customwidget>
</customwidgets>
<tabstops>
+ <tabstop>description</tabstop>
<tabstop>detect</tabstop>
+ <tabstop>detection_delay</tabstop>
<tabstop>wmclass_match</tabstop>
<tabstop>wmclass</tabstop>
<tabstop>edit_reg_wmclass</tabstop>
@@ -2494,13 +2550,22 @@ but this may sometimes fail or superact.
<tabstop>rule_size</tabstop>
<tabstop>size</tabstop>
<tabstop>enable_maximizehoriz</tabstop>
+ <tabstop>rule_maximizehoriz</tabstop>
<tabstop>enable_maximizevert</tabstop>
<tabstop>rule_maximizevert</tabstop>
- <tabstop>enable_fullscreen</tabstop>
<tabstop>enable_desktop</tabstop>
<tabstop>rule_desktop</tabstop>
<tabstop>desktop</tabstop>
+ <tabstop>enable_activity</tabstop>
+ <tabstop>rule_activity</tabstop>
+ <tabstop>activity</tabstop>
+ <tabstop>enable_screen</tabstop>
+ <tabstop>rule_screen</tabstop>
+ <tabstop>screen</tabstop>
+ <tabstop>enable_fullscreen</tabstop>
+ <tabstop>rule_fullscreen</tabstop>
<tabstop>enable_minimize</tabstop>
+ <tabstop>rule_minimize</tabstop>
<tabstop>enable_shade</tabstop>
<tabstop>rule_shade</tabstop>
<tabstop>enable_placement</tabstop>
@@ -2508,26 +2573,61 @@ but this may sometimes fail or superact.
<tabstop>placement</tabstop>
<tabstop>enable_ignoreposition</tabstop>
<tabstop>rule_ignoreposition</tabstop>
+ <tabstop>enable_minsize</tabstop>
+ <tabstop>rule_minsize</tabstop>
+ <tabstop>minsize</tabstop>
<tabstop>enable_maxsize</tabstop>
<tabstop>rule_maxsize</tabstop>
<tabstop>maxsize</tabstop>
+ <tabstop>enable_strictgeometry</tabstop>
+ <tabstop>rule_strictgeometry</tabstop>
<tabstop>enable_above</tabstop>
<tabstop>rule_above</tabstop>
<tabstop>enable_below</tabstop>
<tabstop>rule_below</tabstop>
<tabstop>enable_autogroup</tabstop>
+ <tabstop>rule_autogroup</tabstop>
<tabstop>enable_autogroupfg</tabstop>
<tabstop>rule_autogroupfg</tabstop>
<tabstop>enable_autogroupid</tabstop>
<tabstop>rule_autogroupid</tabstop>
+ <tabstop>autogroupid</tabstop>
+ <tabstop>enable_skiptaskbar</tabstop>
+ <tabstop>rule_skiptaskbar</tabstop>
+ <tabstop>enable_skippager</tabstop>
+ <tabstop>rule_skippager</tabstop>
+ <tabstop>enable_skipswitcher</tabstop>
+ <tabstop>rule_skipswitcher</tabstop>
+ <tabstop>enable_shortcut</tabstop>
+ <tabstop>rule_shortcut</tabstop>
+ <tabstop>shortcut</tabstop>
+ <tabstop>shortcut_edit</tabstop>
<tabstop>enable_noborder</tabstop>
<tabstop>rule_noborder</tabstop>
<tabstop>enable_opacityactive</tabstop>
+ <tabstop>rule_opacityactive</tabstop>
<tabstop>opacityactive</tabstop>
<tabstop>enable_opacityinactive</tabstop>
<tabstop>rule_opacityinactive</tabstop>
<tabstop>opacityinactive</tabstop>
- <tabstop>description</tabstop>
+ <tabstop>enable_moveresizemode</tabstop>
+ <tabstop>rule_moveresizemode</tabstop>
+ <tabstop>moveresizemode</tabstop>
+ <tabstop>enable_fsplevel</tabstop>
+ <tabstop>rule_fsplevel</tabstop>
+ <tabstop>fsplevel</tabstop>
+ <tabstop>enable_acceptfocus</tabstop>
+ <tabstop>rule_acceptfocus</tabstop>
+ <tabstop>enable_disableglobalshortcuts</tabstop>
+ <tabstop>rule_disableglobalshortcuts</tabstop>
+ <tabstop>enable_closeable</tabstop>
+ <tabstop>rule_closeable</tabstop>
+ <tabstop>enable_type</tabstop>
+ <tabstop>rule_type</tabstop>
+ <tabstop>type</tabstop>
+ <tabstop>enable_blockcompositing</tabstop>
+ <tabstop>rule_blockcompositing</tabstop>
+ <tabstop>tabs</tabstop>
</tabstops>
<resources/>
<connections>
@@ -2538,8 +2638,8 @@ but this may sometimes fail or superact.
<slot>detectClicked()</slot>
<hints>
<hint type="sourcelabel">
- <x>247</x>
- <y>89</y>
+ <x>321</x>
+ <y>124</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
@@ -2554,8 +2654,8 @@ but this may sometimes fail or superact.
<slot>wmclassMatchChanged()</slot>
<hints>
<hint type="sourcelabel">
- <x>164</x>
- <y>134</y>
+ <x>301</x>
+ <y>196</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
@@ -2570,8 +2670,8 @@ but this may sometimes fail or superact.
<slot>roleMatchChanged()</slot>
<hints>
<hint type="sourcelabel">
- <x>164</x>
- <y>188</y>
+ <x>301</x>
+ <y>254</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
diff --git a/kwin/manage.cpp b/kwin/manage.cpp
index ddeca11..616f6b8 100644
--- a/kwin/manage.cpp
+++ b/kwin/manage.cpp
@@ -232,6 +232,7 @@ bool Client::manage(Window w, bool isMapped)
area = workspace()->clientArea(FullArea, geom.center(), desktop());
else {
int screen = asn_data.xinerama() == -1 ? workspace()->activeScreen() : asn_data.xinerama();
+ screen = rules()->checkScreen(screen, !isMapped);
area = workspace()->clientArea(PlacementArea, workspace()->screenGeometry(screen).center(), desktop());
}
diff --git a/kwin/rules.cpp b/kwin/rules.cpp
index 5b94e76..406c769 100644
--- a/kwin/rules.cpp
+++ b/kwin/rules.cpp
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ktoolinvocation.h>
#ifndef KCMRULES
+#include <QDesktopWidget>
#include "client.h"
#include "workspace.h"
#endif
@@ -52,6 +53,7 @@ Rules::Rules()
, opacityinactiverule(UnusedForceRule)
, ignorepositionrule(UnusedForceRule)
, desktoprule(UnusedSetRule)
+ , screenrule(UnusedSetRule)
, activityrule(UnusedSetRule)
, typerule(UnusedForceRule)
, maximizevertrule(UnusedSetRule)
@@ -157,6 +159,7 @@ void Rules::readFromCfg(const KConfigGroup& cfg)
opacityinactive = 100;
READ_FORCE_RULE(ignoreposition, , false);
READ_SET_RULE(desktop, , 0);
+ READ_SET_RULE(screen, , 0);
READ_SET_RULE(activity, , QString());
type = readType(cfg, "type");
typerule = type != NET::Unknown ? readForceRule(cfg, "typerule") : UnusedForceRule;
@@ -246,6 +249,7 @@ void Rules::write(KConfigGroup& cfg) const
WRITE_FORCE_RULE(opacityinactive,);
WRITE_FORCE_RULE(ignoreposition,);
WRITE_SET_RULE(desktop,);
+ WRITE_SET_RULE(screen,);
WRITE_SET_RULE(activity,);
WRITE_FORCE_RULE(type, int);
WRITE_SET_RULE(maximizevert,);
@@ -287,6 +291,7 @@ bool Rules::isEmpty() const
&& opacityinactiverule == UnusedForceRule
&& ignorepositionrule == UnusedForceRule
&& desktoprule == UnusedSetRule
+ && screenrule == UnusedSetRule
&& activityrule == UnusedSetRule
&& typerule == UnusedForceRule
&& maximizevertrule == UnusedSetRule
@@ -459,6 +464,10 @@ bool Rules::update(Client* c, int selection)
updated = updated || desktop != c->desktop();
desktop = c->desktop();
}
+ if NOW_REMEMBER(Screen, screen) {
+ updated = updated || screen != c->screen();
+ screen = c->screen();
+ }
if NOW_REMEMBER(Activity, activity) {
// TODO: ivan - multiple activities support
const QString & joinedActivities = c->activities().join(",");
@@ -581,6 +590,7 @@ bool Rules::applyIgnoreGeometry(bool& ignore) const
}
APPLY_RULE(desktop, Desktop, int)
+APPLY_RULE(screen, Screen, int)
APPLY_RULE(activity, Activity, QString)
APPLY_FORCE_RULE(type, Type, NET::WindowType)
@@ -671,6 +681,7 @@ void Rules::discardUsed(bool withdrawn)
DISCARD_USED_FORCE_RULE(opacityinactive);
DISCARD_USED_FORCE_RULE(ignoreposition);
DISCARD_USED_SET_RULE(desktop);
+ DISCARD_USED_SET_RULE(screen);
DISCARD_USED_SET_RULE(activity);
DISCARD_USED_FORCE_RULE(type);
DISCARD_USED_SET_RULE(maximizevert);
@@ -798,6 +809,20 @@ KDecorationDefines::MaximizeMode WindowRules::checkMaximize(MaximizeMode mode, b
return static_cast< MaximizeMode >((vert ? MaximizeVertical : 0) | (horiz ? MaximizeHorizontal : 0));
}
+int WindowRules::checkScreen(int screen, bool init) const
+{
+ if ( rules.count() == 0 )
+ return screen;
+ int ret = screen;
+ for ( QVector< Rules* >::ConstIterator it = rules.constBegin(); it != rules.constEnd(); ++it ) {
+ if ( (*it)->applyScreen( ret, init ))
+ break;
+ }
+ if (ret >= QApplication::desktop()->screenCount())
+ ret = screen;
+ return ret;
+}
+
CHECK_RULE(Minimize, bool)
CHECK_RULE(Shade, ShadeMode)
CHECK_RULE(SkipTaskbar, bool)
@@ -843,6 +868,7 @@ void Client::applyWindowRules()
// MinSize, MaxSize handled by Geometry
// IgnorePosition
setDesktop(desktop());
+ workspace()->sendClientToScreen(this, screen());
setOnActivities(activities());
// Type
maximize(maximizeMode());
diff --git a/kwin/rules.h b/kwin/rules.h
index bf299f0..418311e 100644
--- a/kwin/rules.h
+++ b/kwin/rules.h
@@ -63,6 +63,7 @@ public:
int checkOpacityInactive(int s) const;
bool checkIgnoreGeometry(bool ignore) 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;
NET::WindowType checkType(NET::WindowType type) const;
MaximizeMode checkMaximize(MaximizeMode mode, bool init = false) const;
@@ -106,7 +107,7 @@ public:
Shade = 1<<6, SkipTaskbar = 1<<7, SkipPager = 1<<8,
SkipSwitcher = 1<<9, Above = 1<<10, Below = 1<<11, Fullscreen = 1<<12,
NoBorder = 1<<13, OpacityActive = 1<<14, OpacityInactive = 1<<15,
- Activity = 1<<16, All = 0xffffffff
+ Activity = 1<<16, Screen = 1<<17, All = 0xffffffff
};
Q_DECLARE_FLAGS(Types, Type)
void write(KConfigGroup&) const;
@@ -128,6 +129,7 @@ public:
bool applyOpacityInactive(int& s) const;
bool applyIgnoreGeometry(bool& ignore) const;
bool applyDesktop(int& desktop, bool init) const;
+ bool applyScreen(int& desktop, bool init) const;
bool applyActivity(QString& activity, bool init) const;
bool applyType(NET::WindowType& type) const;
bool applyMaximizeVert(MaximizeMode& mode, bool init) const;
@@ -225,6 +227,8 @@ private:
ForceRule ignorepositionrule;
int desktop;
SetRule desktoprule;
+ int screen;
+ SetRule screenrule;
QString activity;
SetRule activityrule;
NET::WindowType type; // type for setting
diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp
index 258a237..5b37aee 100644
--- a/kwin/workspace.cpp
+++ b/kwin/workspace.cpp
@@ -1744,6 +1744,7 @@ int Workspace::screenNumber(const QPoint& pos) const
void Workspace::sendClientToScreen(Client* c, int screen)
{
+ screen = c->rules()->checkScreen(screen);
if (c->screen() == screen) // Don't use isOnScreen(), that's true even when only partially
return;
GeometryUpdatesBlocker blocker(c);