diff --git a/effects/cube/cube.h b/effects/cube/cube.h --- a/effects/cube/cube.h +++ b/effects/cube/cube.h @@ -245,6 +245,10 @@ // proxy CubeEffectProxy m_proxy; QList< CubeInsideEffect* > m_cubeInsideEffects; + + QAction *m_cubeAction; + QAction *m_cylinderAction; + QAction *m_sphereAction; }; } // namespace diff --git a/effects/cube/cube.cpp b/effects/cube/cube.cpp --- a/effects/cube/cube.cpp +++ b/effects/cube/cube.cpp @@ -91,6 +91,9 @@ , 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,21 +187,21 @@ // 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() << Qt::CTRL + Qt::Key_F11); KGlobalAccel::self()->setShortcut(cubeAction, QList() << Qt::CTRL + Qt::Key_F11); 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()); 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()); @@ -216,6 +219,22 @@ ShaderBinder binder(m_capShader); m_capShader->setUniform(GLShader::Color, capColor); } + + // touch borders + const QVector 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 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() diff --git a/effects/cube/cube.kcfg b/effects/cube/cube.kcfg --- a/effects/cube/cube.kcfg +++ b/effects/cube/cube.kcfg @@ -9,6 +9,9 @@ + + + 0 diff --git a/effects/desktopgrid/desktopgrid.h b/effects/desktopgrid/desktopgrid.h --- a/effects/desktopgrid/desktopgrid.h +++ b/effects/desktopgrid/desktopgrid.h @@ -183,6 +183,8 @@ QVector m_desktopButtonsViews; + QAction *m_activateAction; + }; } // namespace diff --git a/effects/desktopgrid/desktopgrid.cpp b/effects/desktopgrid/desktopgrid.cpp --- a/effects/desktopgrid/desktopgrid.cpp +++ b/effects/desktopgrid/desktopgrid.cpp @@ -64,9 +64,10 @@ , 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() << Qt::CTRL + Qt::Key_F8); @@ -117,6 +118,16 @@ layoutMode = DesktopGridConfig::layoutMode(); customLayoutRows = DesktopGridConfig::customLayoutRows(); m_usePresentWindows = DesktopGridConfig::presentWindows(); + + // deactivate and activate all touch border + const QVector 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); + } } //----------------------------------------------------------------------------- diff --git a/effects/desktopgrid/desktopgrid.kcfg b/effects/desktopgrid/desktopgrid.kcfg --- a/effects/desktopgrid/desktopgrid.kcfg +++ b/effects/desktopgrid/desktopgrid.kcfg @@ -6,6 +6,7 @@ + 0 diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -339,6 +339,10 @@ quint32 id = 0; bool active = false; } m_touch; + + QAction *m_exposeAction; + QAction *m_exposeAllAction; + QAction *m_exposeClassAction; }; } // namespace diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -61,28 +61,31 @@ , 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() << Qt::CTRL + Qt::Key_F9); KGlobalAccel::self()->setShortcut(exposeAction, QList() << Qt::CTRL + Qt::Key_F9); 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() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); KGlobalAccel::self()->setShortcut(exposeAllAction, QList() << Qt::CTRL + Qt::Key_F10 << Qt::Key_LaunchC); shortcutAll = KGlobalAccel::self()->shortcut(exposeAllAction); 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() << Qt::CTRL + Qt::Key_F7); @@ -154,6 +157,22 @@ m_leftButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::leftButtonDesktop(); m_middleButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::middleButtonDesktop(); m_rightButtonDesktop = (DesktopMouseAction)PresentWindowsConfig::rightButtonDesktop(); + + // touch screen edges + const QVector 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 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() diff --git a/effects/presentwindows/presentwindows.kcfg b/effects/presentwindows/presentwindows.kcfg --- a/effects/presentwindows/presentwindows.kcfg +++ b/effects/presentwindows/presentwindows.kcfg @@ -52,5 +52,8 @@ QList<int>() << int(ElectricTopLeft) + + +