add present windows by class to active screen edges

BUG: 288960
This commit is contained in:
Thomas Lübking 2011-12-24 20:26:01 +01:00
parent 03e18bc88b
commit 2b2877ddb1
4 changed files with 34 additions and 3 deletions

View file

@ -156,6 +156,13 @@ void PresentWindowsEffect::reconfigure(ReconfigureFlags)
m_borderActivateAll.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
borderList.clear();
borderList.append(int(ElectricNone));
borderList = conf.readEntry("BorderActivateClass", borderList);
foreach (int i, borderList) {
m_borderActivateClass.append(ElectricBorder(i));
effects->reserveElectricBorder(ElectricBorder(i));
}
m_layoutMode = conf.readEntry("LayoutMode", int(LayoutNatural));
m_showCaptions = conf.readEntry("DrawWindowCaptions", true);
m_showIcons = conf.readEntry("DrawWindowIcons", true);
@ -510,14 +517,26 @@ void PresentWindowsEffect::slotWindowGeometryShapeChanged(EffectWindow* w, const
bool PresentWindowsEffect::borderActivated(ElectricBorder border)
{
if (!m_borderActivate.contains(border) && !m_borderActivateAll.contains(border))
int mode = 0;
if (m_borderActivate.contains(border))
mode |= 1;
else if (m_borderActivateAll.contains(border))
mode |= 2;
else if (m_borderActivateClass.contains(border))
mode |= 4;
if (!mode)
return false;
if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this)
return true;
if (m_borderActivate.contains(border))
if (mode & 1)
toggleActive();
else
else if (mode & 2)
toggleActiveAllDesktops();
else if (mode & 4)
toggleActiveClass();
return true;
}

View file

@ -210,6 +210,7 @@ private:
// User configuration settings
QList<ElectricBorder> m_borderActivate;
QList<ElectricBorder> m_borderActivateAll;
QList<ElectricBorder> m_borderActivateClass;
int m_layoutMode;
bool m_showCaptions;
bool m_showIcons;

View file

@ -195,6 +195,7 @@ void KWinScreenEdgesConfig::monitorInit()
} else {
monitorAddItem(services.first()->name() + " - " + i18n("All Desktops"));
monitorAddItem(services.first()->name() + " - " + i18n("Current Desktop"));
monitorAddItem(services.first()->name() + " - " + i18n("Current Application"));
}
services = trader->query("KWin/Effect", "[X-KDE-PluginInfo-Name] == 'kwin4_effect_desktopgrid'");
if (services.isEmpty()) {
@ -270,6 +271,13 @@ void KWinScreenEdgesConfig::monitorLoad()
foreach (int i, list) {
monitorChangeEdge(ElectricBorder(i), int(PresentWindowsCurrent));
}
// PresentWindows BorderActivateClass
list.clear();
list.append(int(ElectricNone));
list = presentWindowsConfig.readEntry("BorderActivateClass", list);
foreach (int i, list) {
monitorChangeEdge(ElectricBorder(i), int(PresentWindowsClass));
}
// Desktop Grid
KConfigGroup gridConfig(m_config, "Effect-DesktopGrid");
@ -365,6 +373,8 @@ void KWinScreenEdgesConfig::monitorSave()
monitorCheckEffectHasEdge(int(PresentWindowsAll)));
presentWindowsConfig.writeEntry("BorderActivate",
monitorCheckEffectHasEdge(int(PresentWindowsCurrent)));
presentWindowsConfig.writeEntry("BorderActivateClass",
monitorCheckEffectHasEdge(int(PresentWindowsClass)));
// Desktop Grid
KConfigGroup gridConfig(m_config, "Effect-DesktopGrid");

View file

@ -66,6 +66,7 @@ private:
enum EffectActions {
PresentWindowsAll = ELECTRIC_ACTION_COUNT, // Start at the end of built in actions
PresentWindowsCurrent,
PresentWindowsClass,
DesktopGrid,
Cube,
Cylinder,