From e096c605029e999a9d3403dd558e9b73be053bef Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Mon, 16 Nov 2009 11:26:37 +0000 Subject: [PATCH] Allow the autogrouping option to be enabled/disabled on a per-application level by using window rules. svn path=/trunk/KDE/kdebase/workspace/; revision=1050000 --- kcmkwin/kwinrules/ruleswidget.cpp | 5 +++ kcmkwin/kwinrules/ruleswidget.h | 1 + kcmkwin/kwinrules/ruleswidgetbase.ui | 62 +++++++++++++++++++++++----- manage.cpp | 3 +- rules.cpp | 8 ++++ rules.h | 4 ++ 6 files changed, 72 insertions(+), 11 deletions(-) diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index eb18191393..fc33265621 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -98,6 +98,7 @@ RulesWidget::RulesWidget( QWidget* parent ) SETUP( skippager, set ); SETUP( acceptfocus, force ); SETUP( closeable, force ); + SETUP( autogroup, force ); SETUP( opacityactive, force ); SETUP( opacityinactive, force ); SETUP( shortcut, force ); @@ -145,6 +146,7 @@ UPDATE_ENABLE_SLOT( skiptaskbar ) UPDATE_ENABLE_SLOT( skippager ) UPDATE_ENABLE_SLOT( acceptfocus ) UPDATE_ENABLE_SLOT( closeable ) +UPDATE_ENABLE_SLOT( autogroup ) UPDATE_ENABLE_SLOT( opacityactive ) UPDATE_ENABLE_SLOT( opacityinactive ) void RulesWidget::updateEnableshortcut() @@ -420,6 +422,7 @@ void RulesWidget::setRules( Rules* rules ) CHECKBOX_SET_RULE( skippager, ); CHECKBOX_FORCE_RULE( acceptfocus, ); CHECKBOX_FORCE_RULE( closeable, ); + CHECKBOX_FORCE_RULE( autogroup, ); LINEEDIT_FORCE_RULE( opacityactive, intToStr ); LINEEDIT_FORCE_RULE( opacityinactive, intToStr ); LINEEDIT_SET_RULE( shortcut, ); @@ -510,6 +513,7 @@ Rules* RulesWidget::rules() const CHECKBOX_SET_RULE( skippager, ); CHECKBOX_FORCE_RULE( acceptfocus, ); CHECKBOX_FORCE_RULE( closeable, ); + CHECKBOX_FORCE_RULE( autogroup, ); LINEEDIT_FORCE_RULE( opacityactive, strToInt ); LINEEDIT_FORCE_RULE( opacityinactive, strToInt ); LINEEDIT_SET_RULE( shortcut, ); @@ -627,6 +631,7 @@ void RulesWidget::prefillUnusedValues( const KWindowInfo& info ) CHECKBOX_PREFILL( skippager,, info.state() & NET::SkipPager ); //CHECKBOX_PREFILL( acceptfocus, ); //CHECKBOX_PREFILL( closeable, ); + //CHECKBOX_PREFILL( autogroup, ); LINEEDIT_PREFILL( opacityactive, intToStr, 100 /*get the actual opacity somehow*/); LINEEDIT_PREFILL( opacityinactive, intToStr, 100 /*get the actual opacity somehow*/); //LINEEDIT_PREFILL( shortcut, ); diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index 5aa00f343f..3de4963b8b 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -72,6 +72,7 @@ class RulesWidget void updateEnableskippager(); void updateEnableacceptfocus(); void updateEnablecloseable(); + void updateEnableautogroup(); void updateEnableopacityactive(); void updateEnableopacityinactive(); // workarounds tab diff --git a/kcmkwin/kwinrules/ruleswidgetbase.ui b/kcmkwin/kwinrules/ruleswidgetbase.ui index 8e7a93a1c8..4171e62fd5 100644 --- a/kcmkwin/kwinrules/ruleswidgetbase.ui +++ b/kcmkwin/kwinrules/ruleswidgetbase.ui @@ -1150,13 +1150,20 @@ + + + Autogroup with &identical + + + + A&ctive opacity in % - + false @@ -1178,7 +1185,7 @@ - + false @@ -1258,6 +1265,38 @@ + + + + false + + + + + + + + + + false + + + + Do Not Affect + + + + + Force + + + + + Force Temporarily + + + + @@ -1487,7 +1526,7 @@ - + Qt::Vertical @@ -1503,7 +1542,7 @@ - + false @@ -1525,7 +1564,7 @@ - + false @@ -1535,14 +1574,14 @@ - + I&nactive opacity in % - + Shortcut @@ -1552,7 +1591,7 @@ - + false @@ -1589,14 +1628,14 @@ - + Edit... - + false @@ -2125,6 +2164,9 @@ enable_closeable rule_closeable closeable + enable_autogroup + rule_autogroup + autogroup enable_opacityactive rule_opacityactive opacityactive diff --git a/manage.cpp b/manage.cpp index c47d5de8f4..f89fbfa772 100644 --- a/manage.cpp +++ b/manage.cpp @@ -312,7 +312,8 @@ bool Client::manage( Window w, bool isMapped ) group->add( this, -1, true ); break; } - if( !client_group && !isMapped && !session && options->autogroupSimilarWindows ) + if( !client_group && !isMapped && !session && + rules()->checkAutogrouping( options->autogroupSimilarWindows )) { // Attempt to automatically group similar windows const Client* similar = workspace()->findSimilarClient( this ); if( similar && similar->clientGroup() && !similar->noBorder() ) diff --git a/rules.cpp b/rules.cpp index 001229ba04..bbf33da1e3 100644 --- a/rules.cpp +++ b/rules.cpp @@ -68,6 +68,7 @@ Rules::Rules() , acceptfocusrule( UnusedForceRule ) , moveresizemoderule( UnusedForceRule ) , closeablerule( UnusedForceRule ) + , autogrouprule( UnusedForceRule ) , strictgeometryrule( UnusedForceRule ) , shortcutrule( UnusedSetRule ) , disableglobalshortcutsrule( UnusedForceRule ) @@ -168,6 +169,7 @@ void Rules::readFromCfg( const KConfigGroup& cfg ) READ_FORCE_RULE( acceptfocus, , false); READ_FORCE_RULE( moveresizemode,Options::stringToMoveResizeMode, QString()); READ_FORCE_RULE( closeable, , false); + READ_FORCE_RULE( autogroup,, false); READ_FORCE_RULE( strictgeometry, , false); READ_SET_RULE( shortcut, ,QString() ); READ_FORCE_RULE( disableglobalshortcuts, , false); @@ -252,6 +254,7 @@ void Rules::write( KConfigGroup& cfg ) const WRITE_FORCE_RULE( acceptfocus, ); WRITE_FORCE_RULE( moveresizemode, Options::moveResizeModeToString ); WRITE_FORCE_RULE( closeable, ); + WRITE_FORCE_RULE( autogroup, ); WRITE_FORCE_RULE( strictgeometry, ); WRITE_SET_RULE( shortcut, ); WRITE_FORCE_RULE( disableglobalshortcuts, ); @@ -288,6 +291,7 @@ bool Rules::isEmpty() const && acceptfocusrule == UnusedForceRule && moveresizemoderule == UnusedForceRule && closeablerule == UnusedForceRule + && autogrouprule == UnusedForceRule && strictgeometryrule == UnusedForceRule && shortcutrule == UnusedSetRule && disableglobalshortcutsrule == UnusedForceRule ); @@ -612,6 +616,7 @@ APPLY_FORCE_RULE( fsplevel, FSP, int ) 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( strictgeometry, StrictGeometry, bool ) APPLY_RULE( shortcut, Shortcut, QString ) APPLY_FORCE_RULE( disableglobalshortcuts, DisableGlobalShortcuts, bool ) @@ -674,6 +679,7 @@ void Rules::discardUsed( bool withdrawn ) DISCARD_USED_FORCE_RULE( acceptfocus ); DISCARD_USED_FORCE_RULE( moveresizemode ); DISCARD_USED_FORCE_RULE( closeable ); + DISCARD_USED_FORCE_RULE( autogroup ); DISCARD_USED_FORCE_RULE( strictgeometry ); DISCARD_USED_SET_RULE( shortcut ); DISCARD_USED_FORCE_RULE( disableglobalshortcuts ); @@ -794,6 +800,7 @@ CHECK_FORCE_RULE( FSP, int ) CHECK_FORCE_RULE( AcceptFocus, bool ) CHECK_FORCE_RULE( MoveResizeMode, Options::MoveResizeMode ) CHECK_FORCE_RULE( Closeable, bool ) +CHECK_FORCE_RULE( Autogrouping, bool ) CHECK_FORCE_RULE( StrictGeometry, bool ) CHECK_RULE( Shortcut, QString ) CHECK_FORCE_RULE( DisableGlobalShortcuts, bool ) @@ -849,6 +856,7 @@ void Client::applyWindowRules() QSize s = adjustedSize(); if( s != size()) resizeWithChecks( s ); + // Autogrouping : Only checked on window manage // StrictGeometry setShortcut( rules()->checkShortcut( shortcut().toString())); // see also Client::setActive() diff --git a/rules.h b/rules.h index 1152a94c9b..28f9575c0a 100644 --- a/rules.h +++ b/rules.h @@ -77,6 +77,7 @@ class WindowRules bool checkAcceptFocus( bool focus ) const; Options::MoveResizeMode checkMoveResizeMode( Options::MoveResizeMode mode ) const; bool checkCloseable( bool closeable ) const; + bool checkAutogrouping( bool autogroup ) const; bool checkStrictGeometry( bool strict ) const; QString checkShortcut( QString s, bool init = false ) const; bool checkDisableGlobalShortcuts( bool disable ) const; @@ -129,6 +130,7 @@ class Rules bool applyAcceptFocus( bool& focus ) const; bool applyMoveResizeMode( Options::MoveResizeMode& mode ) const; bool applyCloseable( bool& closeable ) const; + bool applyAutogrouping( bool& autogroup ) const; bool applyStrictGeometry( bool& strict ) const; bool applyShortcut( QString& shortcut, bool init ) const; bool applyDisableGlobalShortcuts( bool& disable ) const; @@ -242,6 +244,8 @@ class Rules ForceRule moveresizemoderule; bool closeable; ForceRule closeablerule; + bool autogroup; + ForceRule autogrouprule; bool strictgeometry; ForceRule strictgeometryrule; QString shortcut;