Roles/kde: remove all patches

This commit is contained in:
Toast 2025-07-04 18:00:51 +02:00
parent d87450b305
commit d05764d3dd
6 changed files with 0 additions and 4296 deletions

View file

@ -1,193 +0,0 @@
diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp
index 8d3b5d1a72..4786617ca6 100644
--- a/autotests/integration/lockscreen.cpp
+++ b/autotests/integration/lockscreen.cpp
@@ -665,18 +665,18 @@ void LockScreenTest::testAxisShortcut()
// try to trigger the shortcut
quint32 timestamp = 1;
-#define PERFORM(expectedCount) \
- do { \
- Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
- if (direction == Qt::Vertical) \
- Test::pointerAxisVertical(sign * 5.0, timestamp++); \
- else \
- Test::pointerAxisHorizontal(sign * 5.0, timestamp++); \
- QCoreApplication::instance()->processEvents(); \
- QCOMPARE(actionSpy.count(), expectedCount); \
- Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
- QCoreApplication::instance()->processEvents(); \
- QCOMPARE(actionSpy.count(), expectedCount); \
+#define PERFORM(expectedCount) \
+ do { \
+ Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++); \
+ if (direction == Qt::Vertical) \
+ Test::pointerAxisVertical(sign * 15.0, timestamp++); \
+ else \
+ Test::pointerAxisHorizontal(sign * 15.0, timestamp++); \
+ QCoreApplication::instance()->processEvents(); \
+ QCOMPARE(actionSpy.count(), expectedCount); \
+ Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++); \
+ QCoreApplication::instance()->processEvents(); \
+ QCOMPARE(actionSpy.count(), expectedCount); \
} while (false)
PERFORM(1);
diff --git a/src/globalshortcuts.cpp b/src/globalshortcuts.cpp
index 5682e2a797..40b99d2018 100644
--- a/src/globalshortcuts.cpp
+++ b/src/globalshortcuts.cpp
@@ -240,17 +240,16 @@ bool GlobalShortcutsManager::processKeyRelease(Qt::KeyboardModifiers mods, int k
}
template<typename ShortcutKind, typename... Args>
-bool match(QList<GlobalShortcut> &shortcuts, Args... args)
+GlobalShortcut *match(QList<GlobalShortcut> &shortcuts, Args... args)
{
for (auto &sc : shortcuts) {
if (std::holds_alternative<ShortcutKind>(sc.shortcut())) {
if (std::get<ShortcutKind>(sc.shortcut()) == ShortcutKind{args...}) {
- sc.invoke();
- return true;
+ return &sc;
}
}
}
- return false;
+ return nullptr;
}
// TODO(C++20): use ranges for a nicer way of filtering by shortcut type
@@ -266,10 +265,14 @@ bool GlobalShortcutsManager::processPointerPressed(Qt::KeyboardModifiers mods, Q
Q_ARG(Qt::MouseButtons, pointerButtons));
}
#endif
- return match<PointerButtonShortcut>(m_shortcuts, mods, pointerButtons);
+ GlobalShortcut *shortcut = match<PointerButtonShortcut>(m_shortcuts, mods, pointerButtons);
+ if (shortcut) {
+ shortcut->invoke();
+ }
+ return shortcut != nullptr;
}
-bool GlobalShortcutsManager::processAxis(Qt::KeyboardModifiers mods, PointerAxisDirection axis)
+bool GlobalShortcutsManager::processAxis(Qt::KeyboardModifiers mods, PointerAxisDirection axis, qreal delta)
{
#if KWIN_BUILD_GLOBALSHORTCUTS
// currently only used to better support modifier only shortcuts
@@ -281,7 +284,11 @@ bool GlobalShortcutsManager::processAxis(Qt::KeyboardModifiers mods, PointerAxis
Q_ARG(int, axis));
}
#endif
- return match<PointerAxisShortcut>(m_shortcuts, mods, axis);
+ GlobalShortcut *shortcut = match<PointerAxisShortcut>(m_shortcuts, mods, axis);
+ if (shortcut && std::abs(delta) >= 1.0f) {
+ shortcut->invoke();
+ }
+ return shortcut != nullptr;
}
void GlobalShortcutsManager::processSwipeStart(DeviceType device, uint fingerCount)
diff --git a/src/globalshortcuts.h b/src/globalshortcuts.h
index 13c4239cae..4a2748cf39 100644
--- a/src/globalshortcuts.h
+++ b/src/globalshortcuts.h
@@ -98,7 +98,7 @@ public:
* @param axis The axis direction which has triggered this event
* @return @c true if a shortcut triggered, @c false otherwise
*/
- bool processAxis(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis);
+ bool processAxis(Qt::KeyboardModifiers modifiers, PointerAxisDirection axis, qreal delta);
void processSwipeStart(DeviceType device, uint fingerCount);
void processSwipeUpdate(DeviceType device, const QPointF &delta);
diff --git a/src/input.cpp b/src/input.cpp
index 52dd7be865..4bc5b7f719 100644
--- a/src/input.cpp
+++ b/src/input.cpp
@@ -976,6 +976,29 @@ private:
QMap<quint32, QPointF> m_touchPoints;
};
+class MouseWheelAccumulator
+{
+public:
+ qreal accumulate(PointerAxisEvent *event)
+ {
+ const qreal delta = event->deltaV120 != 0 ? event->deltaV120 / 120.0 : event->delta / 15.0;
+ if (std::signbit(m_scrollDistance) != std::signbit(delta)) {
+ m_scrollDistance = 0;
+ }
+ m_scrollDistance += delta;
+ if (std::abs(m_scrollDistance) >= 1.0) {
+ const qreal ret = m_scrollDistance;
+ m_scrollDistance = std::fmod(m_scrollDistance, 1.0f);
+ return ret - m_scrollDistance;
+ } else {
+ return 0;
+ }
+ }
+
+private:
+ qreal m_scrollDistance = 0;
+};
+
#if KWIN_BUILD_GLOBALSHORTCUTS
class GlobalShortcutFilter : public InputEventFilter
{
@@ -1008,15 +1031,15 @@ public:
} else if (event->delta > 0) {
direction = PointerAxisLeft;
}
+ return input()->shortcuts()->processAxis(event->modifiers, direction, m_horizontalAccumulator.accumulate(event));
} else {
if (event->delta < 0) {
direction = PointerAxisDown;
} else if (event->delta > 0) {
direction = PointerAxisUp;
}
+ return input()->shortcuts()->processAxis(event->modifiers, direction, m_verticalAccumulator.accumulate(event));
}
-
- return input()->shortcuts()->processAxis(event->modifiers, direction);
}
bool keyboardKey(KeyboardKeyEvent *event) override
{
@@ -1229,6 +1252,8 @@ private:
QPointF m_lastAverageDistance;
QMap<int32_t, QPointF> m_touchPoints;
int m_touchpadGestureFingerCount = 0;
+ MouseWheelAccumulator m_horizontalAccumulator;
+ MouseWheelAccumulator m_verticalAccumulator;
QTimer m_powerDown;
};
@@ -1515,28 +1540,6 @@ private:
QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
};
-class MouseWheelAccumulator
-{
-public:
- float accumulate(PointerAxisEvent *event)
- {
- m_scrollV120 += event->deltaV120;
- m_scrollDistance += event->delta;
- if (std::abs(m_scrollV120) >= 120 || (!event->deltaV120 && std::abs(m_scrollDistance) >= 15)) {
- float ret = m_scrollDistance;
- m_scrollV120 = 0;
- m_scrollDistance = 0;
- return ret;
- } else {
- return 0;
- }
- }
-
-private:
- float m_scrollDistance = 0;
- int m_scrollV120 = 0;
-};
-
class DecorationEventFilter : public InputEventFilter
{
public:

View file

@ -1,151 +0,0 @@
diff --git a/autotests/integration/decoration_input_test.cpp b/autotests/integration/decoration_input_test.cpp
index 7390b34aab..61312a389b 100644
--- a/autotests/integration/decoration_input_test.cpp
+++ b/autotests/integration/decoration_input_test.cpp
@@ -655,9 +655,9 @@ void DecorationInputTest::testModifierScrollOpacity()
}
QFETCH(int, modifierKey);
Test::keyboardKeyPressed(modifierKey, timestamp++);
- Test::pointerAxisVertical(-5, timestamp++);
+ Test::pointerAxisVertical(-15, timestamp++);
QCOMPARE(window->opacity(), 0.6);
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
Test::keyboardKeyReleased(modifierKey, timestamp++);
if (capsLock) {
diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp
index 338ad6eca9..8ebd191e9a 100644
--- a/autotests/integration/internal_window.cpp
+++ b/autotests/integration/internal_window.cpp
@@ -291,9 +291,9 @@ void InternalWindowTest::testPointerAxis()
quint32 timestamp = 1;
Test::pointerMotion(QPoint(50, 50), timestamp++);
- Test::pointerAxisVertical(5.0, timestamp++);
+ Test::pointerAxisVertical(15.0, timestamp++);
QTRY_COMPARE(wheelSpy.count(), 1);
- Test::pointerAxisHorizontal(5.0, timestamp++);
+ Test::pointerAxisHorizontal(15.0, timestamp++);
QTRY_COMPARE(wheelSpy.count(), 2);
}
@@ -465,9 +465,9 @@ void InternalWindowTest::testModifierScroll()
QCOMPARE(internalWindow->opacity(), 0.5);
quint32 timestamp = 1;
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
- Test::pointerAxisVertical(-5, timestamp++);
+ Test::pointerAxisVertical(-15, timestamp++);
QCOMPARE(internalWindow->opacity(), 0.6);
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QCOMPARE(internalWindow->opacity(), 0.5);
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
}
diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp
index 8d3b5d1a72..62fe990550 100644
--- a/autotests/integration/lockscreen.cpp
+++ b/autotests/integration/lockscreen.cpp
@@ -339,7 +339,7 @@ void LockScreenTest::testPointerAxis()
// and simulate axis
Test::pointerAxisHorizontal(5.0, timestamp++);
QVERIFY(!axisChangedSpy.wait(10));
- Test::pointerAxisVertical(5.0, timestamp++);
+ Test::pointerAxisVertical(15.0, timestamp++);
QVERIFY(!axisChangedSpy.wait(10));
// and unlock
@@ -348,9 +348,9 @@ void LockScreenTest::testPointerAxis()
QCOMPARE(enteredSpy.count(), 2);
// and move axis again
- Test::pointerAxisHorizontal(5.0, timestamp++);
+ Test::pointerAxisHorizontal(15.0, timestamp++);
QVERIFY(axisChangedSpy.wait());
- Test::pointerAxisVertical(5.0, timestamp++);
+ Test::pointerAxisVertical(15.0, timestamp++);
QVERIFY(axisChangedSpy.wait());
}
diff --git a/autotests/integration/no_global_shortcuts_test.cpp b/autotests/integration/no_global_shortcuts_test.cpp
index 5e5ea1676b..65add952ea 100644
--- a/autotests/integration/no_global_shortcuts_test.cpp
+++ b/autotests/integration/no_global_shortcuts_test.cpp
@@ -177,9 +177,9 @@ void NoGlobalShortcutsTest::testAxisShortcut()
quint32 timestamp = 1;
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
if (direction == Qt::Vertical) {
- Test::pointerAxisVertical(sign * 5.0, timestamp++);
+ Test::pointerAxisVertical(sign * 15.0, timestamp++);
} else {
- Test::pointerAxisHorizontal(sign * 5.0, timestamp++);
+ Test::pointerAxisHorizontal(sign * 15.0, timestamp++);
}
QCoreApplication::instance()->processEvents();
QCOMPARE(actionSpy.count(), 0);
diff --git a/autotests/integration/pointer_constraints_test.cpp b/autotests/integration/pointer_constraints_test.cpp
index 06ab277863..497bb5ac73 100644
--- a/autotests/integration/pointer_constraints_test.cpp
+++ b/autotests/integration/pointer_constraints_test.cpp
@@ -189,9 +189,9 @@ void TestPointerConstraints::testConfinedPointer()
QCOMPARE(window->opacity(), 0.5);
// pointer is confined so shortcut should not work
- Test::pointerAxisVertical(-5, timestamp++);
+ Test::pointerAxisVertical(-15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
Test::keyboardKeyReleased(KEY_LEFTALT, timestamp++);
diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp
index f444471562..12c8c5736b 100644
--- a/autotests/integration/pointer_input.cpp
+++ b/autotests/integration/pointer_input.cpp
@@ -695,9 +695,9 @@ void PointerInputTest::testModifierScrollOpacity()
}
QFETCH(int, modifierKey);
Test::keyboardKeyPressed(modifierKey, timestamp++);
- Test::pointerAxisVertical(-5, timestamp++);
+ Test::pointerAxisVertical(-15, timestamp++);
QCOMPARE(window->opacity(), 0.6);
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
Test::keyboardKeyReleased(modifierKey, timestamp++);
if (capsLock) {
@@ -753,9 +753,9 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled()
// simulate modifier+wheel
quint32 timestamp = 1;
Test::keyboardKeyPressed(KEY_LEFTMETA, timestamp++);
- Test::pointerAxisVertical(-5, timestamp++);
+ Test::pointerAxisVertical(-15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QCOMPARE(window->opacity(), 0.5);
Test::keyboardKeyReleased(KEY_LEFTMETA, timestamp++);
@@ -800,7 +800,7 @@ void PointerInputTest::testScrollAction()
quint32 timestamp = 1;
QVERIFY(!window1->isActive());
- Test::pointerAxisVertical(5, timestamp++);
+ Test::pointerAxisVertical(15, timestamp++);
QVERIFY(window1->isActive());
// but also the wheel event should be passed to the window
diff --git a/autotests/integration/touch_input_test.cpp b/autotests/integration/touch_input_test.cpp
index 8f739ff2a5..df68e1b47e 100644
--- a/autotests/integration/touch_input_test.cpp
+++ b/autotests/integration/touch_input_test.cpp
@@ -146,7 +146,7 @@ void TouchInputTest::testTouchHidesCursor()
QCOMPARE(Cursors::self()->isCursorHidden(), true);
// wheel should also show
- Test::pointerAxisVertical(1.0, timestamp++);
+ Test::pointerAxisVertical(15.0, timestamp++);
QCOMPARE(Cursors::self()->isCursorHidden(), false);
}

View file

@ -1,61 +0,0 @@
From 2022febc84989dba04a4677f3c187a057dece522 Mon Sep 17 00:00:00 2001
From: Aleix Pol <aleixpol@kde.org>
Date: Fri, 4 Apr 2025 00:59:29 +0200
Subject: [PATCH] screenedge: Hardcode the cornerOffset value
At the moment we were using fonts to calculate it which would slow us
down at startup for little pay-off.
We were using visual metrics for a touch scaling which is wrong so let's
just hardcode a value.
On my system (running default fonts) gridUnit was 9 and thus was
resulting on 36, rounded up to 40.
---
src/screenedge.cpp | 9 +--------
src/screenedge.h | 2 +-
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/screenedge.cpp b/src/screenedge.cpp
index adbac936f20..fb42ecc9330 100644
--- a/src/screenedge.cpp
+++ b/src/screenedge.cpp
@@ -42,12 +42,6 @@
#include <QAbstractEventDispatcher>
#include <QAction>
#include <QDBusInterface>
-#include <QDBusPendingCall>
-#include <QFontDatabase>
-#include <QFontMetrics>
-#include <QTextStream>
-#include <QTimer>
-#include <QWidget>
#include <span>
using namespace std::chrono_literals;
@@ -766,10 +760,9 @@ ScreenEdges::ScreenEdges()
, m_actionBottom(ElectricActionNone)
, m_actionBottomLeft(ElectricActionNone)
, m_actionLeft(ElectricActionNone)
+ , m_cornerOffset(40)
, m_gestureRecognizer(new GestureRecognizer(this))
{
- const int gridUnit = QFontMetrics(QFontDatabase::systemFont(QFontDatabase::GeneralFont)).boundingRect(QLatin1Char('M')).height();
- m_cornerOffset = 4 * gridUnit;
}
void ScreenEdges::init()
diff --git a/src/screenedge.h b/src/screenedge.h
index b208edf3c98..8417f2aee57 100644
--- a/src/screenedge.h
+++ b/src/screenedge.h
@@ -388,7 +388,7 @@ private:
ElectricBorderAction m_actionBottomLeft;
ElectricBorderAction m_actionLeft;
QMap<ElectricBorder, ElectricBorderAction> m_touchCallbacks;
- int m_cornerOffset;
+ const int m_cornerOffset;
GestureRecognizer *m_gestureRecognizer;
bool m_remainActiveOnFullscreen = false;
};
--
GitLab