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
This commit is contained in:
Lucas Murray 2009-11-16 11:26:37 +00:00
parent c0c0864860
commit e096c60502
6 changed files with 72 additions and 11 deletions

View file

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

View file

@ -72,6 +72,7 @@ class RulesWidget
void updateEnableskippager();
void updateEnableacceptfocus();
void updateEnablecloseable();
void updateEnableautogroup();
void updateEnableopacityactive();
void updateEnableopacityinactive();
// workarounds tab

View file

@ -1150,13 +1150,20 @@
</widget>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="enable_autogroup" >
<property name="text" >
<string>Autogroup with &amp;identical</string>
</property>
</widget>
</item>
<item row="8" column="0" >
<widget class="QCheckBox" name="enable_opacityactive" >
<property name="text" >
<string>A&amp;ctive opacity in %</string>
</property>
</widget>
</item>
<item row="7" column="1" >
<item row="8" column="1" >
<widget class="KComboBox" name="rule_opacityactive" >
<property name="enabled" >
<bool>false</bool>
@ -1178,7 +1185,7 @@
</item>
</widget>
</item>
<item row="7" column="2" colspan="2" >
<item row="8" column="2" colspan="2" >
<widget class="KRestrictedLine" name="opacityactive" >
<property name="enabled" >
<bool>false</bool>
@ -1258,6 +1265,38 @@
</property>
</widget>
</item>
<item row="7" column="2" >
<widget class="QCheckBox" name="autogroup" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="7" column="1" >
<widget class="KComboBox" name="rule_autogroup" >
<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="6" column="1" >
<widget class="KComboBox" name="rule_closeable" >
<property name="enabled" >
@ -1487,7 +1526,7 @@
</item>
</widget>
</item>
<item row="10" column="1" >
<item row="11" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -1503,7 +1542,7 @@
</property>
</spacer>
</item>
<item row="8" column="1" >
<item row="9" column="1" >
<widget class="KComboBox" name="rule_opacityinactive" >
<property name="enabled" >
<bool>false</bool>
@ -1525,7 +1564,7 @@
</item>
</widget>
</item>
<item row="8" column="2" colspan="2" >
<item row="9" column="2" colspan="2" >
<widget class="KRestrictedLine" name="opacityinactive" >
<property name="enabled" >
<bool>false</bool>
@ -1535,14 +1574,14 @@
</property>
</widget>
</item>
<item row="8" column="0" >
<item row="9" column="0" >
<widget class="QCheckBox" name="enable_opacityinactive" >
<property name="text" >
<string>I&amp;nactive opacity in %</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<item row="10" column="0" >
<widget class="QCheckBox" name="enable_shortcut" >
<property name="text" >
<string>Shortcut</string>
@ -1552,7 +1591,7 @@
</property>
</widget>
</item>
<item row="9" column="1" >
<item row="10" column="1" >
<widget class="KComboBox" name="rule_shortcut" >
<property name="enabled" >
<bool>false</bool>
@ -1589,14 +1628,14 @@
</item>
</widget>
</item>
<item row="9" column="5" >
<item row="10" column="5" >
<widget class="QPushButton" name="shortcut_edit" >
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="9" column="2" colspan="3" >
<item row="10" column="2" colspan="3" >
<widget class="KRestrictedLine" name="shortcut" >
<property name="enabled" >
<bool>false</bool>
@ -2125,6 +2164,9 @@
<tabstop>enable_closeable</tabstop>
<tabstop>rule_closeable</tabstop>
<tabstop>closeable</tabstop>
<tabstop>enable_autogroup</tabstop>
<tabstop>rule_autogroup</tabstop>
<tabstop>autogroup</tabstop>
<tabstop>enable_opacityactive</tabstop>
<tabstop>rule_opacityactive</tabstop>
<tabstop>opacityactive</tabstop>

View file

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

View file

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

View file

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