Add a Minimized combo box to TabBox

This allows to select whether TabBox should exclude minimized windows,
or only show minimized windows or just don't care about minimized windows.
This is the default and the behavior as it used to be.

Signed-off-by: Stefano Avallone <stavallo@unina.it>

REVIEW: 103698
This commit is contained in:
Stefano Avallone 2012-01-27 00:25:32 +01:00 committed by Martin Gräßlin
parent 651a0cca47
commit 2008982069
5 changed files with 86 additions and 0 deletions

View file

@ -135,6 +135,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
// combo boxes
connect(m_primaryTabBoxUi->listModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->minimizedModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->effectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
// check boxes
connect(m_primaryTabBoxUi->showOutlineCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
@ -144,6 +145,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
// combo boxes alternative
connect(m_alternativeTabBoxUi->listModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->minimizedModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->effectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
// check boxes alternative
connect(m_alternativeTabBoxUi->showOutlineCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
@ -226,6 +228,8 @@ void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabB
config.readEntry<int>("ListMode", TabBox::TabBoxConfig::defaultListMode())));
tabBoxConfig.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBox::TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setClientMinimizedMode(TabBox::TabBoxConfig::ClientMinimizedMode(
config.readEntry<int>("MinimizedMode", TabBox::TabBoxConfig::defaultMinimizedMode())));
tabBoxConfig.setLayout(TabBox::TabBoxConfig::LayoutMode(
config.readEntry<int>("LayoutMode", TabBox::TabBoxConfig::defaultLayoutMode())));
tabBoxConfig.setShowDesktop(config.readEntry<bool>("ShowDesktop",
@ -252,6 +256,7 @@ void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabB
// combo boxes
config.writeEntry("ListMode", int(tabBoxConfig.clientListMode()));
config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode()));
config.writeEntry("MinimizedMode", int(tabBoxConfig.clientMinimizedMode()));
config.writeEntry("LayoutMode", int(tabBoxConfig.layout()));
config.writeEntry("LayoutName", tabBoxConfig.layoutName());
config.writeEntry("SelectedLayoutName", tabBoxConfig.selectedItemLayoutName());
@ -354,6 +359,7 @@ void KWinTabBoxConfig::defaults()
// combo boxes
m_primaryTabBoxUi->listModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultListMode());
m_primaryTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
m_primaryTabBoxUi->minimizedModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMinimizedMode());
// checkboxes
m_primaryTabBoxUi->showOutlineCheck->setChecked(TabBox::TabBoxConfig::defaultShowOutline());
@ -368,6 +374,7 @@ void KWinTabBoxConfig::defaults()
// combo boxes
m_alternativeTabBoxUi->listModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultListMode());
m_alternativeTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
m_alternativeTabBoxUi->minimizedModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMinimizedMode());
// checkboxes
m_alternativeTabBoxUi->showOutlineCheck->setChecked(TabBox::TabBoxConfig::defaultShowOutline());
@ -398,6 +405,7 @@ void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm* ui, const KWin::
// combo boxes
ui->listModeCombo->setCurrentIndex(config.clientListMode());
ui->switchingModeCombo->setCurrentIndex(config.clientSwitchingMode());
ui->minimizedModeCombo->setCurrentIndex(config.clientMinimizedMode());
// check boxes
ui->showOutlineCheck->setChecked(config.isShowOutline());
@ -410,6 +418,7 @@ void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm* ui,
{
config.setClientListMode(TabBox::TabBoxConfig::ClientListMode(ui->listModeCombo->currentIndex()));
config.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex()));
config.setClientMinimizedMode(TabBox::TabBoxConfig::ClientMinimizedMode(ui->minimizedModeCombo->currentIndex()));
config.setShowOutline(ui->showOutlineCheck->isChecked());
config.setShowTabBox(ui->showTabBox->isChecked());

View file

@ -90,6 +90,41 @@
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Minimized:</string>
</property>
<property name="buddy">
<cstring>minimizedModeCombo</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KComboBox" name="minimizedModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Ignore status</string>
</property>
</item>
<item>
<property name="text">
<string>Exclude minimized windows</string>
</property>
</item>
<item>
<property name="text">
<string>Minimized windows only</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>

View file

@ -135,6 +135,8 @@ TabBoxClient* TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int des
addClient = current->isOnDesktop(desktop);
addClient = addClient && current->isOnCurrentActivity();
addClient = addClient && current->wantsTabFocus() && !current->skipSwitcher();
addClient = addClient && !(current->isMinimized() && config().clientMinimizedMode() == TabBoxConfig::ExcludeMinimizedClients );
addClient = addClient && !(!current->isMinimized() && config().clientMinimizedMode() == TabBoxConfig::OnlyMinimizedClients);
if (addClient) {
// don't add windows that have modal dialogs
Client* modal = current->findModal();
@ -578,6 +580,8 @@ void TabBox::loadConfig(const KConfigGroup& config, TabBoxConfig& tabBoxConfig)
config.readEntry<int>("ListMode", TabBoxConfig::defaultListMode())));
tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode(
config.readEntry<int>("MinimizedMode", TabBoxConfig::defaultMinimizedMode())));
tabBoxConfig.setShowOutline(config.readEntry<bool>("ShowOutline",
TabBoxConfig::defaultShowOutline()));

View file

@ -35,6 +35,7 @@ public:
, layout(TabBoxConfig::defaultLayoutMode())
, clientListMode(TabBoxConfig::defaultListMode())
, clientSwitchingMode(TabBoxConfig::defaultSwitchingMode())
, clientMinimizedMode(TabBoxConfig::defaultMinimizedMode())
, desktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching)
, minWidth(TabBoxConfig::defaultMinWidth())
, minHeight(TabBoxConfig::defaultMinHeight())
@ -52,6 +53,7 @@ public:
TabBoxConfig::LayoutMode layout;
TabBoxConfig::ClientListMode clientListMode;
TabBoxConfig::ClientSwitchingMode clientSwitchingMode;
TabBoxConfig::ClientMinimizedMode clientMinimizedMode;
TabBoxConfig::DesktopSwitchingMode desktopSwitchingMode;
int minWidth;
int minHeight;
@ -80,6 +82,7 @@ TabBoxConfig& TabBoxConfig::operator=(const KWin::TabBox::TabBoxConfig& object)
d->layout = object.layout();
d->clientListMode = object.clientListMode();
d->clientSwitchingMode = object.clientSwitchingMode();
d->clientMinimizedMode = object.clientMinimizedMode();
d->desktopSwitchingMode = object.desktopSwitchingMode();
d->selectedItemLayoutName = object.selectedItemLayoutName();
d->minWidth = object.minWidth();
@ -158,6 +161,16 @@ void TabBoxConfig::setClientSwitchingMode(ClientSwitchingMode switchingMode)
d->clientSwitchingMode = switchingMode;
}
TabBoxConfig::ClientMinimizedMode TabBoxConfig::clientMinimizedMode() const
{
return d->clientMinimizedMode;
}
void TabBoxConfig::setClientMinimizedMode(ClientMinimizedMode minimizedMode)
{
d->clientMinimizedMode = minimizedMode;
}
TabBoxConfig::DesktopSwitchingMode TabBoxConfig::desktopSwitchingMode() const
{
return d->desktopSwitchingMode;

View file

@ -79,6 +79,15 @@ public:
StackingOrderSwitching ///< Sort by current stacking order
};
/**
* ClientMinimizedMode defines the mode used to create the TabBoxClient List
* in the TabBoxClientModel
*/
enum ClientMinimizedMode {
IgnoreMinimizedStatus, ///< TabBoxClients are included no matter they are minimized or not
ExcludeMinimizedClients, ///< Exclude minimized TabBoxClients
OnlyMinimizedClients ///< Only minimized TabBoxClients are included
};
/**
* DesktopSwitchingMode defines the sorting of the desktops in the
* TabBoxDesktopModel.
*/
@ -146,6 +155,13 @@ public:
*/
ClientSwitchingMode clientSwitchingMode() const;
/**
* @return The current ClientMinimizedMode
* This option only applies for TabBoxMode ClientTabBox.
* @see setClientMinimizedMode
* @see defaultMinimizedMode
*/
ClientMinimizedMode clientMinimizedMode() const;
/**
* @return The current DesktopSwitchingMode
* This option only applies for TabBoxMode DesktopTabBox.
* @see setDesktopSwitchingMode
@ -223,6 +239,12 @@ public:
*/
void setClientSwitchingMode(ClientSwitchingMode switchingMode);
/**
* @param minimizedMode The new ClientMinimizedMode to be used.
* This option only applies for TabBoxMode ClientTabBox.
* @see clientMinimizedMode
*/
void setClientMinimizedMode(ClientMinimizedMode minimizedMode);
/**
* @param switchingMode The new DesktopSwitchingMode to be used.
* This option only applies for TabBoxMode DesktopTabBox.
* @see desktopSwitchingMode
@ -261,6 +283,9 @@ public:
static ClientSwitchingMode defaultSwitchingMode() {
return FocusChainSwitching;
}
static ClientMinimizedMode defaultMinimizedMode() {
return IgnoreMinimizedStatus;
}
static LayoutMode defaultLayoutMode() {
return VerticalLayout;
}