nix-stuff/roles/kde/patches/kwin/pr7441.patch
2025-04-15 16:39:04 +02:00

61 lines
2 KiB
Diff

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