From d7b1e5fc5370ba8c92ea0ab1c2b2495d57e068d0 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Tue, 17 Nov 2009 10:41:32 +0000 Subject: [PATCH] Added window rule version of opening window tabs in the background. svn path=/trunk/KDE/kdebase/workspace/; revision=1050444 --- kcmkwin/kwinrules/ruleswidget.cpp | 5 +++ kcmkwin/kwinrules/ruleswidget.h | 1 + kcmkwin/kwinrules/ruleswidgetbase.ui | 63 ++++++++++++++++++++++------ manage.cpp | 3 +- rules.cpp | 8 ++++ rules.h | 4 ++ 6 files changed, 71 insertions(+), 13 deletions(-) diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index ce7d2d023d..52d489b522 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -99,6 +99,7 @@ RulesWidget::RulesWidget( QWidget* parent ) SETUP( acceptfocus, force ); SETUP( closeable, force ); SETUP( autogroup, force ); + SETUP( autogroupfg, force ); SETUP( autogroupid, force ); SETUP( opacityactive, force ); SETUP( opacityinactive, force ); @@ -148,6 +149,7 @@ UPDATE_ENABLE_SLOT( skippager ) UPDATE_ENABLE_SLOT( acceptfocus ) UPDATE_ENABLE_SLOT( closeable ) UPDATE_ENABLE_SLOT( autogroup ) +UPDATE_ENABLE_SLOT( autogroupfg ) UPDATE_ENABLE_SLOT( autogroupid ) UPDATE_ENABLE_SLOT( opacityactive ) UPDATE_ENABLE_SLOT( opacityinactive ) @@ -425,6 +427,7 @@ void RulesWidget::setRules( Rules* rules ) CHECKBOX_FORCE_RULE( acceptfocus, ); CHECKBOX_FORCE_RULE( closeable, ); CHECKBOX_FORCE_RULE( autogroup, ); + CHECKBOX_FORCE_RULE( autogroupfg, ); LINEEDIT_FORCE_RULE( autogroupid, ); LINEEDIT_FORCE_RULE( opacityactive, intToStr ); LINEEDIT_FORCE_RULE( opacityinactive, intToStr ); @@ -517,6 +520,7 @@ Rules* RulesWidget::rules() const CHECKBOX_FORCE_RULE( acceptfocus, ); CHECKBOX_FORCE_RULE( closeable, ); CHECKBOX_FORCE_RULE( autogroup, ); + CHECKBOX_FORCE_RULE( autogroupfg, ); LINEEDIT_FORCE_RULE( autogroupid, ); LINEEDIT_FORCE_RULE( opacityactive, strToInt ); LINEEDIT_FORCE_RULE( opacityinactive, strToInt ); @@ -636,6 +640,7 @@ void RulesWidget::prefillUnusedValues( const KWindowInfo& info ) //CHECKBOX_PREFILL( acceptfocus, ); //CHECKBOX_PREFILL( closeable, ); //CHECKBOX_PREFILL( autogroup, ); + //CHECKBOX_PREFILL( autogroupfg, ); //LINEEDIT_PREFILL( autogroupid, ); LINEEDIT_PREFILL( opacityactive, intToStr, 100 /*get the actual opacity somehow*/); LINEEDIT_PREFILL( opacityinactive, intToStr, 100 /*get the actual opacity somehow*/); diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index fd65ce4bda..e6aafd6e07 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -73,6 +73,7 @@ class RulesWidget void updateEnableacceptfocus(); void updateEnablecloseable(); void updateEnableautogroup(); + void updateEnableautogroupfg(); void updateEnableautogroupid(); void updateEnableopacityactive(); void updateEnableopacityinactive(); diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 3f617d3a30..4453e72eb3 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -1157,20 +1157,27 @@ + + + Autog&roup in foreground + + + + Autogroup by I&D - + A&ctive opacity in % - + false @@ -1192,7 +1199,7 @@ - + false @@ -1283,13 +1290,23 @@ + + + false + + + + + + + false - + false @@ -1311,6 +1328,28 @@ + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + @@ -1562,7 +1601,7 @@ - + Qt::Vertical @@ -1578,7 +1617,7 @@ - + false @@ -1600,7 +1639,7 @@ - + false @@ -1610,14 +1649,14 @@ - + I&nactive opacity in % - + Shortcut @@ -1627,7 +1666,7 @@ - + false @@ -1664,14 +1703,14 @@ - + Edit... - + false diff --git a/manage.cpp b/manage.cpp index 561da0c5cf..88f69c3e76 100644 --- a/manage.cpp +++ b/manage.cpp @@ -318,7 +318,8 @@ bool Client::manage( Window w, bool isMapped ) const Client* similar = workspace()->findSimilarClient( this ); if( similar && similar->clientGroup() && !similar->noBorder() ) { - similar->clientGroup()->add( this, -1, options->autogroupInForeground ); + similar->clientGroup()->add( this, -1, + rules()->checkAutogroupInForeground( options->autogroupInForeground )); // Don't move entire group geom = QRect( similar->pos() + similar->clientPos(), similar->clientSize() ); placementDone = true; diff --git a/rules.cpp b/rules.cpp index 37d9b71f65..81ab820ffa 100644 --- a/rules.cpp +++ b/rules.cpp @@ -69,6 +69,7 @@ Rules::Rules() , moveresizemoderule( UnusedForceRule ) , closeablerule( UnusedForceRule ) , autogrouprule( UnusedForceRule ) + , autogroupfgrule( UnusedForceRule ) , autogroupidrule( UnusedForceRule ) , strictgeometryrule( UnusedForceRule ) , shortcutrule( UnusedSetRule ) @@ -171,6 +172,7 @@ void Rules::readFromCfg( const KConfigGroup& cfg ) READ_FORCE_RULE( moveresizemode,Options::stringToMoveResizeMode, QString()); READ_FORCE_RULE( closeable, , false); READ_FORCE_RULE( autogroup,, false); + READ_FORCE_RULE( autogroupfg,, true); READ_FORCE_RULE( autogroupid,, QString()); READ_FORCE_RULE( strictgeometry, , false); READ_SET_RULE( shortcut, ,QString() ); @@ -257,6 +259,7 @@ void Rules::write( KConfigGroup& cfg ) const WRITE_FORCE_RULE( moveresizemode, Options::moveResizeModeToString ); WRITE_FORCE_RULE( closeable, ); WRITE_FORCE_RULE( autogroup, ); + WRITE_FORCE_RULE( autogroupfg, ); WRITE_FORCE_RULE( autogroupid, ); WRITE_FORCE_RULE( strictgeometry, ); WRITE_SET_RULE( shortcut, ); @@ -295,6 +298,7 @@ bool Rules::isEmpty() const && moveresizemoderule == UnusedForceRule && closeablerule == UnusedForceRule && autogrouprule == UnusedForceRule + && autogroupfgrule == UnusedForceRule && autogroupidrule == UnusedForceRule && strictgeometryrule == UnusedForceRule && shortcutrule == UnusedSetRule @@ -621,6 +625,7 @@ APPLY_FORCE_RULE( acceptfocus, AcceptFocus, bool ) APPLY_FORCE_RULE( moveresizemode, MoveResizeMode, Options::MoveResizeMode ) APPLY_FORCE_RULE( closeable, Closeable, bool ) APPLY_FORCE_RULE( autogroup, Autogrouping, bool ) +APPLY_FORCE_RULE( autogroupfg, AutogroupInForeground, bool ) APPLY_FORCE_RULE( autogroupid, AutogroupById, QString ) APPLY_FORCE_RULE( strictgeometry, StrictGeometry, bool ) APPLY_RULE( shortcut, Shortcut, QString ) @@ -685,6 +690,7 @@ void Rules::discardUsed( bool withdrawn ) DISCARD_USED_FORCE_RULE( moveresizemode ); DISCARD_USED_FORCE_RULE( closeable ); DISCARD_USED_FORCE_RULE( autogroup ); + DISCARD_USED_FORCE_RULE( autogroupfg ); DISCARD_USED_FORCE_RULE( autogroupid ); DISCARD_USED_FORCE_RULE( strictgeometry ); DISCARD_USED_SET_RULE( shortcut ); @@ -807,6 +813,7 @@ CHECK_FORCE_RULE( AcceptFocus, bool ) CHECK_FORCE_RULE( MoveResizeMode, Options::MoveResizeMode ) CHECK_FORCE_RULE( Closeable, bool ) CHECK_FORCE_RULE( Autogrouping, bool ) +CHECK_FORCE_RULE( AutogroupInForeground, bool ) CHECK_FORCE_RULE( AutogroupById, QString ) CHECK_FORCE_RULE( StrictGeometry, bool ) CHECK_RULE( Shortcut, QString ) @@ -864,6 +871,7 @@ void Client::applyWindowRules() if( s != size()) resizeWithChecks( s ); // Autogrouping : Only checked on window manage + // AutogroupInForeground : Only checked on window manage // AutogroupById : Only checked on window manage // StrictGeometry setShortcut( rules()->checkShortcut( shortcut().toString())); diff --git a/rules.h b/rules.h index 55e1a75f90..60d469d93b 100644 --- a/rules.h +++ b/rules.h @@ -78,6 +78,7 @@ class WindowRules Options::MoveResizeMode checkMoveResizeMode( Options::MoveResizeMode mode ) const; bool checkCloseable( bool closeable ) const; bool checkAutogrouping( bool autogroup ) const; + bool checkAutogroupInForeground( bool fg ) const; QString checkAutogroupById( QString id ) const; bool checkStrictGeometry( bool strict ) const; QString checkShortcut( QString s, bool init = false ) const; @@ -132,6 +133,7 @@ class Rules bool applyMoveResizeMode( Options::MoveResizeMode& mode ) const; bool applyCloseable( bool& closeable ) const; bool applyAutogrouping( bool& autogroup ) const; + bool applyAutogroupInForeground( bool& fg ) const; bool applyAutogroupById( QString& id ) const; bool applyStrictGeometry( bool& strict ) const; bool applyShortcut( QString& shortcut, bool init ) const; @@ -248,6 +250,8 @@ class Rules ForceRule closeablerule; bool autogroup; ForceRule autogrouprule; + bool autogroupfg; + ForceRule autogroupfgrule; QString autogroupid; ForceRule autogroupidrule; bool strictgeometry;