Register touch screen edges in effects
Summary: All effects which use a (pointer) screen edge now also support the touch screen edges. These are: * Cube (cylinder, sphere) * DesktopGrid * PresentWindows (current, all, class) Reviewers: #kwin, #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D5269
This commit is contained in:
parent
e1a46976e6
commit
c080dca8ec
9 changed files with 73 additions and 7 deletions
|
@ -91,6 +91,9 @@ CubeEffect::CubeEffect()
|
|||
, mAddedHeightCoeff2(0.0f)
|
||||
, m_cubeCapBuffer(NULL)
|
||||
, m_proxy(this)
|
||||
, m_cubeAction(new QAction(this))
|
||||
, m_cylinderAction(new QAction(this))
|
||||
, m_sphereAction(new QAction(this))
|
||||
{
|
||||
desktopNameFont.setBold(true);
|
||||
desktopNameFont.setPointSize(14);
|
||||
|
@ -184,7 +187,7 @@ void CubeEffect::reconfigure(ReconfigureFlags)
|
|||
|
||||
// do not connect the shortcut if we use cylinder or sphere
|
||||
if (!shortcutsRegistered) {
|
||||
QAction* cubeAction = new QAction(this);
|
||||
QAction* cubeAction = m_cubeAction;
|
||||
cubeAction->setObjectName(QStringLiteral("Cube"));
|
||||
cubeAction->setText(i18n("Desktop Cube"));
|
||||
KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
|
||||
|
@ -192,13 +195,13 @@ void CubeEffect::reconfigure(ReconfigureFlags)
|
|||
effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F11, cubeAction);
|
||||
effects->registerPointerShortcut(Qt::ControlModifier | Qt::AltModifier, Qt::LeftButton, cubeAction);
|
||||
cubeShortcut = KGlobalAccel::self()->shortcut(cubeAction);
|
||||
QAction* cylinderAction = new QAction(this);
|
||||
QAction* cylinderAction = m_cylinderAction;
|
||||
cylinderAction->setObjectName(QStringLiteral("Cylinder"));
|
||||
cylinderAction->setText(i18n("Desktop Cylinder"));
|
||||
KGlobalAccel::self()->setShortcut(cylinderAction, QList<QKeySequence>());
|
||||
effects->registerGlobalShortcut(QKeySequence(), cylinderAction);
|
||||
cylinderShortcut = KGlobalAccel::self()->shortcut(cylinderAction);
|
||||
QAction* sphereAction = new QAction(this);
|
||||
QAction* sphereAction = m_sphereAction;
|
||||
sphereAction->setObjectName(QStringLiteral("Sphere"));
|
||||
sphereAction->setText(i18n("Desktop Sphere"));
|
||||
KGlobalAccel::self()->setShortcut(sphereAction, QList<QKeySequence>());
|
||||
|
@ -216,6 +219,22 @@ void CubeEffect::reconfigure(ReconfigureFlags)
|
|||
ShaderBinder binder(m_capShader);
|
||||
m_capShader->setUniform(GLShader::Color, capColor);
|
||||
}
|
||||
|
||||
// touch borders
|
||||
const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom};
|
||||
for (auto e : relevantBorders) {
|
||||
effects->unregisterTouchBorder(e, m_cubeAction);
|
||||
effects->unregisterTouchBorder(e, m_sphereAction);
|
||||
effects->unregisterTouchBorder(e, m_cylinderAction);
|
||||
}
|
||||
auto touchEdge = [] (const QList<int> touchBorders, QAction *action) {
|
||||
for (int i : touchBorders) {
|
||||
effects->registerTouchBorder(ElectricBorder(i), action);
|
||||
}
|
||||
};
|
||||
touchEdge(CubeConfig::touchBorderActivate(), m_cubeAction);
|
||||
touchEdge(CubeConfig::touchBorderActivateCylinder(), m_cylinderAction);
|
||||
touchEdge(CubeConfig::touchBorderActivateSphere(), m_sphereAction);
|
||||
}
|
||||
|
||||
CubeEffect::~CubeEffect()
|
||||
|
|
|
@ -245,6 +245,10 @@ private:
|
|||
// proxy
|
||||
CubeEffectProxy m_proxy;
|
||||
QList< CubeInsideEffect* > m_cubeInsideEffects;
|
||||
|
||||
QAction *m_cubeAction;
|
||||
QAction *m_cylinderAction;
|
||||
QAction *m_sphereAction;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
<entry name="BorderActivate" type="IntList" />
|
||||
<entry name="BorderActivateCylinder" type="IntList" />
|
||||
<entry name="BorderActivateSphere" type="IntList" />
|
||||
<entry name="TouchBorderActivate" type="IntList" />
|
||||
<entry name="TouchBorderActivateCylinder" type="IntList" />
|
||||
<entry name="TouchBorderActivateSphere" type="IntList" />
|
||||
<entry name="RotationDuration" type="Int">
|
||||
<default>0</default>
|
||||
</entry>
|
||||
|
|
|
@ -64,9 +64,10 @@ DesktopGridEffect::DesktopGridEffect()
|
|||
, scaledSize()
|
||||
, scaledOffset()
|
||||
, m_proxy(0)
|
||||
, m_activateAction(new QAction(this))
|
||||
{
|
||||
// Load shortcuts
|
||||
QAction* a = new QAction(this);
|
||||
QAction* a = m_activateAction;
|
||||
a->setObjectName(QStringLiteral("ShowDesktopGrid"));
|
||||
a->setText(i18n("Show Desktop Grid"));
|
||||
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F8);
|
||||
|
@ -117,6 +118,16 @@ void DesktopGridEffect::reconfigure(ReconfigureFlags)
|
|||
layoutMode = DesktopGridConfig::layoutMode();
|
||||
customLayoutRows = DesktopGridConfig::customLayoutRows();
|
||||
m_usePresentWindows = DesktopGridConfig::presentWindows();
|
||||
|
||||
// deactivate and activate all touch border
|
||||
const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom};
|
||||
for (auto e : relevantBorders) {
|
||||
effects->unregisterTouchBorder(e, m_activateAction);
|
||||
}
|
||||
const auto touchBorders = DesktopGridConfig::touchBorderActivate();
|
||||
for (int i : touchBorders) {
|
||||
effects->registerTouchBorder(ElectricBorder(i), m_activateAction);
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -183,6 +183,8 @@ private:
|
|||
|
||||
QVector<DesktopButtonsView*> m_desktopButtonsViews;
|
||||
|
||||
QAction *m_activateAction;
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<kcfgfile name="kwinrc"/>
|
||||
<group name="Effect-DesktopGrid">
|
||||
<entry name="BorderActivate" type="IntList" />
|
||||
<entry name="TouchBorderActivate" type="IntList" />
|
||||
<entry name="ZoomDuration" type="Int">
|
||||
<default>0</default>
|
||||
</entry>
|
||||
|
|
|
@ -61,11 +61,14 @@ PresentWindowsEffect::PresentWindowsEffect()
|
|||
, m_filterFrame(NULL)
|
||||
, m_closeView(NULL)
|
||||
, m_closeWindow(NULL)
|
||||
, m_exposeAction(new QAction(this))
|
||||
, m_exposeAllAction(new QAction(this))
|
||||
, m_exposeClassAction(new QAction(this))
|
||||
{
|
||||
m_atomDesktop = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_DESKTOP", this);
|
||||
m_atomWindows = effects->announceSupportProperty("_KDE_PRESENT_WINDOWS_GROUP", this);
|
||||
|
||||
QAction* exposeAction = new QAction(this);
|
||||
QAction* exposeAction = m_exposeAction;
|
||||
exposeAction->setObjectName(QStringLiteral("Expose"));
|
||||
exposeAction->setText(i18n("Toggle Present Windows (Current desktop)"));
|
||||
KGlobalAccel::self()->setDefaultShortcut(exposeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F9);
|
||||
|
@ -73,7 +76,7 @@ PresentWindowsEffect::PresentWindowsEffect()
|
|||
shortcut = KGlobalAccel::self()->shortcut(exposeAction);
|
||||
effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F9, exposeAction);
|
||||
connect(exposeAction, SIGNAL(triggered(bool)), this, SLOT(toggleActive()));
|
||||
QAction* exposeAllAction = new QAction(this);
|
||||
QAction* exposeAllAction = m_exposeAllAction;
|
||||
exposeAllAction->setObjectName(QStringLiteral("ExposeAll"));
|
||||
exposeAllAction->setText(i18n("Toggle Present Windows (All desktops)"));
|
||||
KGlobalAccel::self()->setDefaultShortcut(exposeAllAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC);
|
||||
|
@ -82,7 +85,7 @@ PresentWindowsEffect::PresentWindowsEffect()
|
|||
effects->registerGlobalShortcut(Qt::CTRL + Qt::Key_F10, exposeAllAction);
|
||||
effects->registerTouchpadSwipeShortcut(SwipeDirection::Down, exposeAllAction);
|
||||
connect(exposeAllAction, SIGNAL(triggered(bool)), this, SLOT(toggleActiveAllDesktops()));
|
||||
QAction* exposeClassAction = new QAction(this);
|
||||
QAction* exposeClassAction = m_exposeClassAction;
|
||||
exposeClassAction->setObjectName(QStringLiteral("ExposeClass"));
|
||||
exposeClassAction->setText(i18n("Toggle Present Windows (Window class)"));
|
||||
KGlobalAccel::self()->setDefaultShortcut(exposeClassAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F7);
|
||||
|
@ -154,6 +157,22 @@ void PresentWindowsEffect::reconfigure(ReconfigureFlags)
|
|||
m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop();
|
||||
m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop();
|
||||
m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop();
|
||||
|
||||
// touch screen edges
|
||||
const QVector<ElectricBorder> relevantBorders{ElectricLeft, ElectricTop, ElectricRight, ElectricBottom};
|
||||
for (auto e : relevantBorders) {
|
||||
effects->unregisterTouchBorder(e, m_exposeAction);
|
||||
effects->unregisterTouchBorder(e, m_exposeAllAction);
|
||||
effects->unregisterTouchBorder(e, m_exposeClassAction);
|
||||
}
|
||||
auto touchEdge = [] (const QList<int> touchBorders, QAction *action) {
|
||||
for (int i : touchBorders) {
|
||||
effects->registerTouchBorder(ElectricBorder(i), action);
|
||||
}
|
||||
};
|
||||
touchEdge(PresentWindowsConfig::touchBorderActivate(), m_exposeAction);
|
||||
touchEdge(PresentWindowsConfig::touchBorderActivateAll(), m_exposeAllAction);
|
||||
touchEdge(PresentWindowsConfig::touchBorderActivateClass(), m_exposeClassAction);
|
||||
}
|
||||
|
||||
void* PresentWindowsEffect::proxy()
|
||||
|
|
|
@ -339,6 +339,10 @@ private:
|
|||
quint32 id = 0;
|
||||
bool active = false;
|
||||
} m_touch;
|
||||
|
||||
QAction *m_exposeAction;
|
||||
QAction *m_exposeAllAction;
|
||||
QAction *m_exposeClassAction;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -52,5 +52,8 @@
|
|||
<default code="true">QList<int>() << int(ElectricTopLeft)</default>
|
||||
</entry>
|
||||
<entry name="BorderActivateClass" type="IntList" />
|
||||
<entry name="TouchBorderActivate" type="IntList" />
|
||||
<entry name="TouchBorderActivateAll" type="IntList"/>
|
||||
<entry name="TouchBorderActivateClass" type="IntList" />
|
||||
</group>
|
||||
</kcfg>
|
||||
|
|
Loading…
Reference in a new issue