From 3855b9253b45df3e9429161865c1f5ff45ac664d Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Tue, 17 Nov 2009 07:51:55 +0000 Subject: [PATCH] Added global setting to allow opening automatically grouped windows in the background. svn path=/trunk/KDE/kdebase/workspace/; revision=1050313 --- kcmkwin/kwinoptions/windows.cpp | 40 +++++++++++++++++++++++++++------ kcmkwin/kwinoptions/windows.h | 4 ++++ manage.cpp | 2 +- options.cpp | 1 + options.h | 1 + 5 files changed, 40 insertions(+), 8 deletions(-) diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index b823ffbe07..368e2c956e 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -62,6 +62,7 @@ #define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel" #define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive" #define KWIN_AUTOGROUP_SIMILAR "AutogroupSimilarWindows" +#define KWIN_AUTOGROUP_FOREGROUND "AutogroupInForeground" #define KWIN_SEPARATE_SCREEN_FOCUS "SeparateScreenFocus" #define KWIN_ACTIVE_MOUSE_SCREEN "ActiveMouseScreen" @@ -540,6 +541,31 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KCom lay->addWidget(shBox); + //---------------- + // Window tabbing + + wtBox = new KButtonGroup(this); + wtBox->setTitle(i18n("Window Tabbing")); + QVBoxLayout *wtLay = new QVBoxLayout(wtBox); + + autogroupSimilarWindows = new QCheckBox( i18n( "Automatically group similar windows" ), this ); + autogroupSimilarWindows->setWhatsThis( + i18n( "When turned on attempt to automatically detect when a newly opened window is related" + " to an existing one and place them in the same window group." )); + connect(autogroupSimilarWindows, SIGNAL(toggled(bool)), SLOT(changed())); + wtLay->addWidget( autogroupSimilarWindows ); + + autogroupInForeground = new QCheckBox( i18n( "Switch to automatically grouped windows immediately" ), this ); + autogroupInForeground->setWhatsThis( + i18n( "When turned on immediately switch to any new window tabs that were automatically added" + " to the current group." )); + connect(autogroupInForeground, SIGNAL(toggled(bool)), SLOT(changed())); + wtLay->addWidget( autogroupInForeground ); + + lay->addWidget(wtBox); + + //---------------- + // Any changes goes to slotChanged() connect(shadeHoverOn, SIGNAL(toggled(bool)), SLOT(changed())); connect(shadeHover, SIGNAL(valueChanged(int)), SLOT(changed())); @@ -593,13 +619,6 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, const KCom connect(hideUtilityWindowsForInactive, SIGNAL(toggled(bool)), SLOT(changed())); vLay->addWidget( hideUtilityWindowsForInactive, 1, 0, 1, 2 ); - autogroupSimilarWindows = new QCheckBox( i18n( "Automatically group similar windows" ), this ); - autogroupSimilarWindows->setWhatsThis( - i18n( "When turned on attempt to automatically detect when a newly opened window is related" - " to an existing one and place them in the same window group." )); - connect(autogroupSimilarWindows, SIGNAL(toggled(bool)), SLOT(changed())); - vLay->addWidget( autogroupSimilarWindows, 2, 0, 1, 2 ); - lay->addStretch(); load(); @@ -671,6 +690,7 @@ void KAdvancedConfig::load( void ) setHideUtilityWindowsForInactive( cg.readEntry( KWIN_HIDE_UTILITY, true)); setAutogroupSimilarWindows( cg.readEntry( KWIN_AUTOGROUP_SIMILAR, false)); + setAutogroupInForeground( cg.readEntry( KWIN_AUTOGROUP_FOREGROUND, true)); emit KCModule::changed(false); } @@ -710,6 +730,7 @@ void KAdvancedConfig::save( void ) cg.writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked()); cg.writeEntry(KWIN_AUTOGROUP_SIMILAR, autogroupSimilarWindows->isChecked()); + cg.writeEntry(KWIN_AUTOGROUP_FOREGROUND, autogroupInForeground->isChecked()); if (standAlone) { @@ -730,6 +751,7 @@ void KAdvancedConfig::defaults() setPlacement(SMART_PLACEMENT); setHideUtilityWindowsForInactive( true ); setAutogroupSimilarWindows( false ); + setAutogroupInForeground( true ); emit KCModule::changed(true); } @@ -753,6 +775,10 @@ void KAdvancedConfig::setAutogroupSimilarWindows(bool s) { autogroupSimilarWindows->setChecked( s ); } +void KAdvancedConfig::setAutogroupInForeground(bool s) { + autogroupInForeground->setChecked( s ); +} + KMovingConfig::~KMovingConfig () { if (standAlone) diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h index 24562df8d3..890c1bd635 100644 --- a/kcmkwin/kwinoptions/windows.h +++ b/kcmkwin/kwinoptions/windows.h @@ -194,6 +194,7 @@ private: void setShadeHoverInterval(int); KButtonGroup *shBox; + KButtonGroup *wtBox; QCheckBox *shadeHoverOn; QLabel *shadeHoverLabel; KIntNumInput *shadeHover; @@ -207,6 +208,9 @@ private: void setAutogroupSimilarWindows( bool ); QCheckBox* autogroupSimilarWindows; + void setAutogroupInForeground( bool ); + QCheckBox* autogroupInForeground; + int getPlacement( void ); //CT void setPlacement(int); //CT KComboBox *placementCombo; diff --git a/manage.cpp b/manage.cpp index e21a392b76..561da0c5cf 100644 --- a/manage.cpp +++ b/manage.cpp @@ -318,7 +318,7 @@ bool Client::manage( Window w, bool isMapped ) const Client* similar = workspace()->findSimilarClient( this ); if( similar && similar->clientGroup() && !similar->noBorder() ) { - similar->clientGroup()->add( this, -1, true ); + similar->clientGroup()->add( this, -1, options->autogroupInForeground ); // Don't move entire group geom = QRect( similar->pos() + similar->clientPos(), similar->clientSize() ); placementDone = true; diff --git a/options.cpp b/options.cpp index 5fca867bc5..6a9e852ce3 100644 --- a/options.cpp +++ b/options.cpp @@ -170,6 +170,7 @@ unsigned long Options::updateSettings() killPingTimeout = config.readEntry( "KillPingTimeout", 5000 ); hideUtilityWindowsForInactive = config.readEntry( "HideUtilityWindowsForInactive", true); autogroupSimilarWindows = config.readEntry( "AutogroupSimilarWindows", false ); + autogroupInForeground = config.readEntry( "AutogroupInForeground", true ); showDesktopIsMinimizeAll = config.readEntry( "ShowDesktopIsMinimizeAll", false ); borderless_maximized_windows = config.readEntry( "BorderlessMaximizedWindows", false ); diff --git a/options.h b/options.h index 8541012ddf..ca46f445df 100644 --- a/options.h +++ b/options.h @@ -322,6 +322,7 @@ class Options : public KDecorationOptions bool hideUtilityWindowsForInactive; bool autogroupSimilarWindows; + bool autogroupInForeground; // Compositing settings bool useCompositing;