From 72b6b32c58202db4bc2d9ee0ecda843b38d1d5b5 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Thu, 28 Aug 2025 10:45:04 -0700 Subject: [PATCH] Remove unnecessary package installs from Dockerfile, improve findFocusedMonitor logic --- kwin/docker-build/Dockerfile | 3 --- kwin/docker-build/Dockerfile.steamos | 3 --- kwin/src/qml/BreezyDesktop.qml | 3 --- kwin/src/qml/Displays.qml | 20 ++++++++------------ 4 files changed, 8 insertions(+), 21 deletions(-) diff --git a/kwin/docker-build/Dockerfile b/kwin/docker-build/Dockerfile index 51def55..89d8677 100644 --- a/kwin/docker-build/Dockerfile +++ b/kwin/docker-build/Dockerfile @@ -30,9 +30,6 @@ RUN pacman -Sy --noconfirm --needed \ kwindowsystem \ kwin \ && pacman -Scc --noconfirm - RUN pacman -Sy --noconfirm --needed \ - python \ - && pacman -Scc --noconfirm WORKDIR /source diff --git a/kwin/docker-build/Dockerfile.steamos b/kwin/docker-build/Dockerfile.steamos index 3670dbc..23f32e6 100644 --- a/kwin/docker-build/Dockerfile.steamos +++ b/kwin/docker-build/Dockerfile.steamos @@ -31,9 +31,6 @@ RUN pacman -Sy --noconfirm --needed \ kwindowsystem \ kwin \ && pacman -Scc --noconfirm - RUN pacman -Sy --noconfirm --needed \ - python \ - && pacman -Scc --noconfirm WORKDIR /source diff --git a/kwin/src/qml/BreezyDesktop.qml b/kwin/src/qml/BreezyDesktop.qml index a566edb..8ffa052 100644 --- a/kwin/src/qml/BreezyDesktop.qml +++ b/kwin/src/qml/BreezyDesktop.qml @@ -83,9 +83,6 @@ Node { const focusedDisplay = focusedIndex !== -1 ? breezyDesktop.displayAtIndex(focusedIndex) : null; if (focusedIndex !== breezyDesktop.focusedMonitorIndex) { - // zoomOutAnimation.stop(); - // zoomInAnimation.stop(); - // zoomOnFocusSequence.stop(); if (focusedDisplay === null) { zoomOutAnimation.target = breezyDesktop.displayAtIndex(breezyDesktop.focusedMonitorIndex); zoomOutAnimation.target.targetDistance = zoomOutAnimation.to; diff --git a/kwin/src/qml/Displays.qml b/kwin/src/qml/Displays.qml index 3dc73ee..69e79af 100644 --- a/kwin/src/qml/Displays.qml +++ b/kwin/src/qml/Displays.qml @@ -306,11 +306,8 @@ QtObject { return monitorPlacements; } - // returns how far the look vector is from the center of the monitor, as a percentage of the monitor's width + // 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) { - var monitorAspectRatio = monitorDetails.width / monitorDetails.height; - - // weight the up distance by the aspect ratio var vectorUpPixels = upAngleToLength( fovDetails.defaultDistanceVerticalRadians, fovDetails.heightPixels, @@ -318,7 +315,7 @@ QtObject { monitorVector.z, monitorVector.x ); - var upDeltaPixels = (lookUpPixels - vectorUpPixels) * monitorAspectRatio; + var upPercentage = Math.abs(lookUpPixels - vectorUpPixels) / monitorDetails.height; var vectorWestPixels = westAngleToLength( fovDetails.defaultDistanceHorizontalRadians, @@ -327,11 +324,10 @@ QtObject { monitorVector.y, monitorVector.x ); - var westDeltaPixels = lookWestPixels - vectorWestPixels; - var totalDeltaPixels = Math.sqrt(upDeltaPixels * upDeltaPixels + westDeltaPixels * westDeltaPixels); + var westPercentage = Math.abs(lookWestPixels - vectorWestPixels) / monitorDetails.width; - // threshold is a percentage of width, and height was already properly weighted - return totalDeltaPixels / monitorDetails.width; + // how close we are to any edge is the largest of the two percentages + return Math.max(upPercentage, westPercentage); } function findFocusedMonitor(quaternion, monitorVectors, currentFocusedIndex, smoothFollowEnabled, fovDetails, monitorsDetails) { @@ -356,9 +352,6 @@ QtObject { rotatedLookVector.x ); - var closestIndex = -1; - var closestDistance = Number.POSITIVE_INFINITY; - // Check current focused monitor first if (currentFocusedIndex !== -1) { var focusedDistance = getMonitorDistance( @@ -375,6 +368,9 @@ QtObject { return currentFocusedIndex; } + var closestIndex = -1; + var closestDistance = Number.POSITIVE_INFINITY; + // Find the closest monitor for (var i = 0; i < monitorVectors.length; ++i) { if (i === currentFocusedIndex)