diff --git a/kcmkwin/kwinoptions/windows.cpp b/kcmkwin/kwinoptions/windows.cpp index cfa4a01ee9..8ebd63b7f4 100644 --- a/kcmkwin/kwinoptions/windows.cpp +++ b/kcmkwin/kwinoptions/windows.cpp @@ -75,6 +75,7 @@ #define KWIN_SHADEHOVER "ShadeHover" #define KWIN_SHADEHOVER_INTERVAL "ShadeHoverInterval" #define KWIN_FOCUS_STEALING "FocusStealingPreventionLevel" +#define KWIN_HIDE_UTILITY "HideUtilityWindowsForInactive" // kwm config keywords #define KWM_ELECTRIC_BORDER "ElectricBorders" @@ -608,8 +609,15 @@ KAdvancedConfig::KAdvancedConfig (bool _standAlone, KConfig *_config, QWidget *p "" ); QWhatsThis::add( focusStealing, wtstr ); QWhatsThis::add( focusStealingLabel, wtstr ); - connect(focusStealing, SIGNAL(activated(int)), SLOT(changed())); + + hideUtilityWindowsForInactive = new QCheckBox( i18n( "Hide utility windows for inactive applications" ), this ); + QWhatsThis::add( hideUtilityWindowsForInactive, + i18n( "When turned on, utility windows (tool windows, torn-off menus,...) of inactive applications will be" + " hidden and will be shown only when the application becomes active. Note that applications" + " have to mark the windows with the proper window type for this feature to work." )); + connect(hideUtilityWindowsForInactive, SIGNAL(toggled(bool)), SLOT(changed())); + lay->addWidget( hideUtilityWindowsForInactive ); lay->addStretch(); load(); @@ -643,6 +651,10 @@ void KAdvancedConfig::setFocusStealing(int l) { focusStealing->setCurrentItem(l); } +void KAdvancedConfig::setHideUtilityWindowsForInactive(bool s) { + hideUtilityWindowsForInactive->setChecked( s ); +} + void KAdvancedConfig::load( void ) { config->setGroup( "Windows" ); @@ -657,6 +669,7 @@ void KAdvancedConfig::load( void ) // setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 2 )); // TODO default to low for now setFocusStealing( config->readNumEntry(KWIN_FOCUS_STEALING, 1 )); + setHideUtilityWindowsForInactive( config->readBoolEntry( KWIN_HIDE_UTILITY, true )); emit KCModule::changed(false); } @@ -680,6 +693,7 @@ void KAdvancedConfig::save( void ) config->writeEntry(KWM_ELECTRIC_BORDER_DELAY,getElectricBorderDelay()); config->writeEntry(KWIN_FOCUS_STEALING, focusStealing->currentItem()); + config->writeEntry(KWIN_HIDE_UTILITY, hideUtilityWindowsForInactive->isChecked()); if (standAlone) { @@ -701,6 +715,7 @@ void KAdvancedConfig::defaults() // setFocusStealing(2); // TODO default to low for now setFocusStealing(1); + setHideUtilityWindowsForInactive( true ); emit KCModule::changed(true); } diff --git a/kcmkwin/kwinoptions/windows.h b/kcmkwin/kwinoptions/windows.h index 96d285b49d..84ae69e11e 100644 --- a/kcmkwin/kwinoptions/windows.h +++ b/kcmkwin/kwinoptions/windows.h @@ -223,8 +223,10 @@ private: KIntNumInput *delays; void setFocusStealing( int ); + void setHideUtilityWindowsForInactive( bool ); QComboBox* focusStealing; + QCheckBox* hideUtilityWindowsForInactive; }; class KProcess; diff --git a/options.cpp b/options.cpp index e3bba65aa3..9d52018d7f 100644 --- a/options.cpp +++ b/options.cpp @@ -151,6 +151,7 @@ unsigned long Options::updateSettings() (*it) = (*it).lower(); killPingTimeout = config->readNumEntry( "KillPingTimeout", 5000 ); + hideUtilityWindowsForInactive = config->readBoolEntry( "HideUtilityWindowsForInactive", false ); // Mouse bindings config->setGroup( "MouseBindings"); diff --git a/options.h b/options.h index da4836905f..e78df74907 100644 --- a/options.h +++ b/options.h @@ -277,6 +277,9 @@ class Options : public KDecorationOptions // timeout before non-responding application will be killed after attempt to close int killPingTimeout; + // Whether to hide utility windows for inactive applications. + bool hideUtilityWindowsForInactive; + //translucency settings bool useTranslucency; bool translucentActiveWindows; diff --git a/workspace.cpp b/workspace.cpp index 74a541afc8..22167d661f 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -681,6 +681,14 @@ void Workspace::updateCurrentTopMenu() void Workspace::updateToolWindows( bool also_hide ) { // TODO what if Client's transiency/group changes? should this be called too? (I'm paranoid, am I not?) + if( !options->hideUtilityWindowsForInactive ) + { + for( ClientList::ConstIterator it = clients.begin(); + it != clients.end(); + ++it ) + (*it)->hideClient( false ); + return; + } const Group* group = NULL; const Client* client = active_client; // Go up in transiency hiearchy, if the top is found, only tool transients for the top mainwindow @@ -816,6 +824,7 @@ void Workspace::slotReconfigure() popupinfo->reconfigure(); readShortcuts(); forEachClient( CheckIgnoreFocusStealingProcedure()); + updateToolWindows( true ); if( mgr->reset( changed )) { // decorations need to be recreated