From 538782b5855dc307e539c59c650156e027b73413 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Wed, 14 Jan 2026 15:37:53 -0800 Subject: [PATCH] Port over more of the monitor distance logic, v2.6.3 --- VERSION | 2 +- kwin/src/kcm/breezydesktopeffectkcm.h | 2 ++ kwin/src/qml/Displays.qml | 17 +++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 097a15a..ec1cf33 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.2 +2.6.3 diff --git a/kwin/src/kcm/breezydesktopeffectkcm.h b/kwin/src/kcm/breezydesktopeffectkcm.h index bc64832..27ec9cd 100644 --- a/kwin/src/kcm/breezydesktopeffectkcm.h +++ b/kwin/src/kcm/breezydesktopeffectkcm.h @@ -73,6 +73,8 @@ private: int m_smoothFollowThreshold = 1; QString m_connectedDeviceBrand; QString m_connectedDeviceModel; + int m_connectedDeviceFullDistanceCm = 0; + int m_connectedDeviceFullSizeCm = 0; QTimer m_statePollTimer; // periodic driver state polling QTimer m_virtualDisplayPollTimer; // periodic virtual display list polling bool m_licenseLoading = false; diff --git a/kwin/src/qml/Displays.qml b/kwin/src/qml/Displays.qml index 8040b47..f488605 100644 --- a/kwin/src/qml/Displays.qml +++ b/kwin/src/qml/Displays.qml @@ -367,23 +367,28 @@ QtObject { // returns how far the look vector is from the center of the monitor, as a percentage of the monitor's dimensions function getMonitorDistance(fovDetails, lookUpPixels, lookWestPixels, monitorVector, monitorDetails, upAngleToLength, westAngleToLength) { + // since the monitor vector has been modified to be relative to the lens position, we need to calculate its distance from the lens + // we need to adjust all angle-based lengths based on new vector distance + const monitorDistance = monitorVector.length(); + const distanceAdjustment = monitorDistance / fovDetails.completeScreenDistancePixels; + var vectorUpPixels = upAngleToLength( fovDetails.defaultDistanceVerticalRadians, fovDetails.heightPixels, - fovDetails.completeScreenDistancePixels, + monitorDistance, monitorVector.z, monitorVector.x - ); - var upPercentage = Math.abs(lookUpPixels - vectorUpPixels) / monitorDetails.height; + ) * distanceAdjustment; + var upPercentage = Math.abs(lookUpPixels * distanceAdjustment - vectorUpPixels) / monitorDetails.height; var vectorWestPixels = westAngleToLength( fovDetails.defaultDistanceHorizontalRadians, fovDetails.widthPixels, - fovDetails.completeScreenDistancePixels, + monitorDistance, monitorVector.y, monitorVector.x - ); - var westPercentage = Math.abs(lookWestPixels - vectorWestPixels) / monitorDetails.width; + ) * distanceAdjustment; + var westPercentage = Math.abs(lookWestPixels * distanceAdjustment - vectorWestPixels) / monitorDetails.width; // how close we are to any edge is the largest of the two percentages return Math.max(upPercentage, westPercentage);