Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:epopov:branches:openSUSE:Factory
kwin6
2002-gestures.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2002-gestures.patch of Package kwin6
diff --git a/src/plugins/overview/overvieweffect.cpp b/src/plugins/overview/overvieweffect.cpp index 8867f43a033486b3e0ddddb9b9c8e5ab924227c4..133cb48b8176bbb9e312d777f567405a38cdc919 100644 --- a/src/plugins/overview/overvieweffect.cpp +++ b/src/plugins/overview/overvieweffect.cpp @@ -33,16 +33,16 @@ OverviewEffect::OverviewEffect() , m_shutdownTimer(new QTimer(this)) { auto gesture = new EffectTogglableGesture(m_overviewState); - gesture->addTouchpadSwipeGesture(SwipeDirection::Up, 4); + gesture->addTouchpadSwipeGesture(SwipeDirection::Up, 3); gesture->addTouchscreenSwipeGesture(SwipeDirection::Up, 3); auto transitionGesture = new EffectTogglableGesture(m_transitionState); - transitionGesture->addTouchpadSwipeGesture(SwipeDirection::Up, 4); + transitionGesture->addTouchpadSwipeGesture(SwipeDirection::Up, 3); transitionGesture->addTouchscreenSwipeGesture(SwipeDirection::Up, 3); m_transitionState->stop(); auto gridGesture = new EffectTogglableGesture(m_gridState); - gridGesture->addTouchpadSwipeGesture(SwipeDirection::Down, 4); + gridGesture->addTouchpadSwipeGesture(SwipeDirection::Down, 3); gridGesture->addTouchscreenSwipeGesture(SwipeDirection::Down, 3); connect(m_overviewState, &EffectTogglableState::inProgressChanged, this, &OverviewEffect::overviewGestureInProgressChanged); diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index 7f5350ef396f9e043b09e4ba6e5f6345a9b449c6..203c7415ed2fcfabe58812d67c6991e0a7eb60c6 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -13,6 +13,7 @@ #include "config-kwin.h" +#include "core/inputdevice.h" #include "core/output.h" #include "cursorsource.h" #include "decorations/decoratedclient.h" @@ -339,8 +340,10 @@ void PointerInputRedirection::processSwipeGestureUpdate(const QPointF &delta, st } update(); - input()->processSpies(std::bind(&InputEventSpy::swipeGestureUpdate, std::placeholders::_1, delta, time)); - input()->processFilters(std::bind(&InputEventFilter::swipeGestureUpdate, std::placeholders::_1, delta, time)); + const auto factor = device->isNaturalScroll() ? 1 : -1; + + input()->processSpies(std::bind(&InputEventSpy::swipeGestureUpdate, std::placeholders::_1, factor * delta, time)); + input()->processFilters(std::bind(&InputEventFilter::swipeGestureUpdate, std::placeholders::_1, factor * delta, time)); } void PointerInputRedirection::processSwipeGestureEnd(std::chrono::microseconds time, KWin::InputDevice *device) diff --git a/src/virtualdesktops.cpp b/src/virtualdesktops.cpp index a0a09040d486162f2f2a95490d54b15d46fb7d48..2942443e0da1099d2980cf5c73c66573a738e66b 100644 --- a/src/virtualdesktops.cpp +++ b/src/virtualdesktops.cpp @@ -29,7 +29,7 @@ namespace KWin { static bool s_loadingDesktopSettings = false; -static const double GESTURE_SWITCH_THRESHOLD = .25; +static const double GESTURE_SWITCH_THRESHOLD = .5; static QString generateDesktopId() { @@ -758,41 +758,39 @@ void VirtualDesktopManager::initShortcuts() connect(m_swipeGestureReleasedY.get(), &QAction::triggered, this, &VirtualDesktopManager::gestureReleasedY); const auto left = [this](qreal cb) { - if (grid().width() > 1) { + if (current() == count()) { + return; + } + const QPoint coords = m_grid.gridCoords(m_current); + if (coords.x() < m_grid.width() - 1) { m_currentDesktopOffset.setX(cb); Q_EMIT currentChanging(currentDesktop(), m_currentDesktopOffset); + } else if (coords.y() < m_grid.height() - 1) { + m_currentDesktopOffset.setX(-cb * std::max(m_grid.width() - 1, 1)); + m_currentDesktopOffset.setY(cb); + const qreal visualOffsetX = coords.x() > 0 ? m_currentDesktopOffset.x() : 0; + Q_EMIT currentChanging(currentDesktop(), QPointF(visualOffsetX, m_currentDesktopOffset.y())); } }; const auto right = [this](qreal cb) { - if (grid().width() > 1) { + if (current() == 1) { + return; + } + const QPoint coords = m_grid.gridCoords(m_current); + if (coords.x() > 0) { m_currentDesktopOffset.setX(-cb); Q_EMIT currentChanging(currentDesktop(), m_currentDesktopOffset); + } else if (coords.y() > 0) { + m_currentDesktopOffset.setX(cb * std::max(m_grid.width() - 1, 1)); + m_currentDesktopOffset.setY(-cb); + const qreal visualOffsetX = coords.x() < m_grid.width() - 1 ? m_currentDesktopOffset.x() : 0; + Q_EMIT currentChanging(currentDesktop(), QPointF(visualOffsetX, m_currentDesktopOffset.y())); } }; input()->registerTouchpadSwipeShortcut(SwipeDirection::Left, 3, m_swipeGestureReleasedX.get(), left); input()->registerTouchpadSwipeShortcut(SwipeDirection::Right, 3, m_swipeGestureReleasedX.get(), right); - input()->registerTouchpadSwipeShortcut(SwipeDirection::Left, 4, m_swipeGestureReleasedX.get(), left); - input()->registerTouchpadSwipeShortcut(SwipeDirection::Right, 4, m_swipeGestureReleasedX.get(), right); - input()->registerTouchpadSwipeShortcut(SwipeDirection::Down, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) { - if (grid().height() > 1) { - m_currentDesktopOffset.setY(-cb); - Q_EMIT currentChanging(currentDesktop(), m_currentDesktopOffset); - } - }); - input()->registerTouchpadSwipeShortcut(SwipeDirection::Up, 3, m_swipeGestureReleasedY.get(), [this](qreal cb) { - if (grid().height() > 1) { - m_currentDesktopOffset.setY(cb); - Q_EMIT currentChanging(currentDesktop(), m_currentDesktopOffset); - } - }); input()->registerTouchscreenSwipeShortcut(SwipeDirection::Left, 3, m_swipeGestureReleasedX.get(), left); input()->registerTouchscreenSwipeShortcut(SwipeDirection::Right, 3, m_swipeGestureReleasedX.get(), right); - - // axis events - input()->registerAxisShortcut(Qt::MetaModifier | Qt::AltModifier, PointerAxisDown, - findChild<QAction *>(QStringLiteral("Switch to Next Desktop"))); - input()->registerAxisShortcut(Qt::MetaModifier | Qt::AltModifier, PointerAxisUp, - findChild<QAction *>(QStringLiteral("Switch to Previous Desktop"))); } void VirtualDesktopManager::gestureReleasedY() @@ -820,10 +818,22 @@ void VirtualDesktopManager::gestureReleasedX() // Note that if desktop wrapping is disabled and there's no desktop to left or right, // toLeft() and toRight() will return the current desktop. VirtualDesktop *target = m_current; - if (m_currentDesktopOffset.x() <= -GESTURE_SWITCH_THRESHOLD) { - target = toLeft(m_current, isNavigationWrappingAround()); - } else if (m_currentDesktopOffset.x() >= GESTURE_SWITCH_THRESHOLD) { - target = toRight(m_current, isNavigationWrappingAround()); + qreal offset = m_currentDesktopOffset.x(); + if (!qFuzzyIsNull(m_currentDesktopOffset.y())) { + offset = offset / std::max(m_grid.width() - 1, 1); + } + if (offset <= -GESTURE_SWITCH_THRESHOLD) { + if (m_currentDesktopOffset.y() > 0) { + target = next(m_current, false); + } else { + target = previous(m_current, false); + } + } else if (offset >= GESTURE_SWITCH_THRESHOLD) { + if (m_currentDesktopOffset.y() < 0) { + target = previous(m_current, false); + } else { + target = next(m_current, false); + } } // If the current desktop has not changed, consider that the gesture has been canceled.
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor