26 Commits (master)

Author SHA1 Message Date
Xaver Hugl 1746af4b02 gesture: use the global direction enums 2 years ago
John Brooks a1191bea18 wayland: Fix missing relative motion events
Use isNull on QSizeF to check for a zero delta instead of comparing it
with a default-constructed QSizeF, which in practice initializes to
(-1.0,-1.0). This caused relative motion events to be omitted if the
delta happened to be equal to (-1.0,-1.0), causing mouse jumping in some
applications.

BUG: 444510

Signed-off-by: John Brooks <john@fastquake.com>
2 years ago
Vlad Zahorodnii 6d3f00e82c autotests: Remove QVERIFY(signalSpy.isValid())
We use the PMF syntax so the isValid() check is unnecessary as the
compiler will notify about wrong signal at compile time. It makes
writing autotests feel less boilerplaty.
2 years ago
Vlad Zahorodnii 38600a6235 Revert "Merge gesture structs/enums"
This reverts commit d29c7a6c2b.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Vlad Zahorodnii db1ec66eb1 Revert "Move gesture direction to base class"
This reverts commit 634182d489.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Vlad Zahorodnii e3df43c701 Revert "Add new gestures and improve naming clarity in gesture.h"
This reverts commit bc15b72e3d.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Vlad Zahorodnii d23781d87a Revert "Clarify interface and improve documentation in gesture"
This reverts commit 6c0ed14800.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Vlad Zahorodnii 74da80763f Revert "Rename GestureDirection to GestureType"
This reverts commit 5de6c507db.

It was pushed with unreviewed changes and not fully resolved issues.
2 years ago
Eric Edlund 5de6c507db Rename GestureDirection to GestureType 2 years ago
Eric Edlund 6c0ed14800 Clarify interface and improve documentation in gesture
Separate trigger progress and semantic progress in gesture.
Move effect activation and desktop switching over to semantic progress.
Allow semantic progress to exceed 1 for overshoot in animations.
2 years ago
Eric Edlund bc15b72e3d Add new gestures and improve naming clarity in gesture.h
I've added VerticalAxis, HorizontalAxis, DirectionlessSwipe and BiDirectionalPinch gestures directions.
These are all combinations of other gesture directions that semantically work well together.
I've implemented these gestures as well as changed some labels and improved documentation,

Also,
Add vector signal to SwipeGesture
2 years ago
Eric Edlund 634182d489 Move gesture direction to base class 2 years ago
Eric Edlund d29c7a6c2b Merge gesture structs/enums
- Now only 1 GestureDirection enum
- Now only 1 registerGesture() call
- The 4 kinds of gesture (Pinch/Swipe) and (Touchpad/Touchscreen) in globalshortcuts.h/cpp are merged into 1 GestureShortcut
- Change from range to set of finger counts in gestures

No behavior should change, just a refactor.
2 years ago
Xaver Hugl 8955a2420e replace all uses of QScopedPointer with std::unique_ptr 2 years ago
Vlad Zahorodnii 7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
3 years ago
Eric Edlund 1f8a65c434 Rename DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is now DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
3 years ago
Vlad Zahorodnii 91632bd030 Revert "Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer"
This reverts commit a508a8c6db.

It didn't go through code review process.
3 years ago
Eric Edlund a508a8c6db Refactor DEFAULT_MINIMUM_SCALE_DELTA in GestureRecognizer
This constant is not DEFAULT_UNIT_SCALE_DELTA.
This makes more sense now that we're using realtime gestures.
3 years ago
Eric Edlund 5cf8db26ec Changes to GestureRecognizer and gestures 3 years ago
Xaver Hugl 93ec5d8ea9 tests: fix GestureTest 3 years ago
Vlad Zahorodnii 68c675d00d Make source code more relocatable
Occasionally, I see complaints about the file organization of kwin,
which is fair enough.

This change makes the source code more relocatable by removing relative
paths from includes.

CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.

With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
4 years ago
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 4 years ago
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
4 years ago
David Edmundson a3cff85e7a Remove Qt module declarations in includes
Summary:
Test Plan: Compiles

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13359
6 years ago
Martin Gräßlin aa6c8f8116 Add support for activating screenedges through touch swipe gestures
Summary:
Each Edge creates a SwipeGesture for touch activation. The swipe needs to
be a single finger starting from the edge into the screen for at least
20 %. The SwipeGesture and GestureRecognizer is extended to support the
use cases of the touch screen edge swipe.

New features supported by the gesture system are:
 * minimum and maximum position
 * a minimum delta for the swipe
 * progress signal based on the minimum delta
 * starting a swipe with a start point

The Edge has the progress signal connected to its approach signal, thus
visual feedback is provided through the screen edge effect.

The screen edge system supports touch only for the edges (corners are
too difficult to activate on touch screens). At the moment the following
features are supported:
 * screen edge show/raise of windows (e.g. auto hidden panels)
 * trigger the configured action
 * trigger the configured callback function (e.g. script)

In future it might make sense to add a touch specific configuration
action to support different actions for screen edges activated by mouse
and touch.

BUG: 370323

Test Plan:
configured a screen edge and triggered through touch,
added an auto-hiding panel and triggered through touch

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5106
8 years ago
Martin Gräßlin 22c91df2ec Add support for global touchpad swipe gestures
Summary:
This change adds global touchpad swipe gestures to the
GlobalShortcutsManager and hooks up the swipe gestures as defined at the
Plasma Affenfels sprint:
 * swipe up: Desktop Grid
 * swipe down: Present Windows
 * swipe left: previous virtual desktop
 * swipe right: next virtual desktop

The main work is handled by two new classes: SwipeGesture and
GestureRecognizer. This is implemented in a way that it can be extended
to also recognize touch screen gestures and pinch gestures.

The SwipeGesture defines what is required for the gesture to trigger.
Currently this includes the minimum and maximum number of fingers
participating in the gesture and the direction. The gesture gets
registered in the GestureRecognizer.

The events for the gesture are fed into the GestureRecognizer. It
evaluates which gestures could trigger and tracks them for every update
of the gesture. In the process of the gesture tracking the
GestureRecognizer emits signals on the Gesture:
 * started: when the Gesture gets considered for a sequence
 * cancelled: the Gesture no longer matches the sequence
 * triggered: the sequence ended and the Gesture still matches

The remaining changes are related to hook up the existing shortcut
framework with the new touchpad gestures. The GlobalShortcutManager
gained support for it, InputRedirection and EffectsHandler offer methods
to register a QAction. VirtualDesktopManager, PresentWindows and
DesktopGrid are adjusted to support the gesture.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5097
8 years ago