From 59c89afc78c791d3507bbd1a3f1ab3393ab25423 Mon Sep 17 00:00:00 2001 From: Pablo P Varela Date: Thu, 6 Jun 2024 23:00:44 +0200 Subject: [PATCH] move comment and add more circles --- Swift Shift/src/windows/WindowManager.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Swift Shift/src/windows/WindowManager.swift b/Swift Shift/src/windows/WindowManager.swift index b38e7d6..0171e08 100644 --- a/Swift Shift/src/windows/WindowManager.swift +++ b/Swift Shift/src/windows/WindowManager.swift @@ -148,7 +148,7 @@ class WindowManager { static func convertYCoordinateBecauseTheAreTwoFuckingCoordinateSystems(point: NSPoint) -> NSPoint { return NSPoint(x: point.x, y: CGDisplayBounds(CGMainDisplayID()).height - point.y) } - + static func getPosition(window: AXUIElement) -> NSPoint? { var positionRef: CFTypeRef? @@ -164,13 +164,16 @@ class WindowManager { static func getWindowBounds(windowLocation: NSPoint, windowSize: CGSize) -> WindowBounds { let windowLocationWithFixedCoordinates = WindowManager.convertYCoordinateBecauseTheAreTwoFuckingCoordinateSystems(point: windowLocation) -// drawCircleAt(x: windowLocationWithFixedCoordinates.x, y: windowLocationWithFixedCoordinates.y, diameter: 10, color: .blue) -// drawCircleAt(x: windowLocationWithFixedCoordinates.x + windowSize.width, y:windowLocationWithFixedCoordinates.y-windowSize.height, diameter: 10, color: .green) let topLeft = NSPoint(x: windowLocationWithFixedCoordinates.x, y: windowLocationWithFixedCoordinates.y) let topRight = NSPoint(x: windowLocationWithFixedCoordinates.x + windowSize.width, y: windowLocationWithFixedCoordinates.y) let bottomLeft = NSPoint(x: windowLocationWithFixedCoordinates.x, y: windowLocationWithFixedCoordinates.y - windowSize.height) let bottomRight = NSPoint(x: windowLocationWithFixedCoordinates.x + windowSize.width, y: windowLocationWithFixedCoordinates.y - windowSize.height) + // drawCircleAt(x: topLeft.x, y: topLeft.y, diameter: 10, color: .blue) + // drawCircleAt(x: topRight.x, y: topRight.y, diameter: 10, color: .blue) + // drawCircleAt(x: bottomLeft.x, y: bottomLeft.y, diameter: 10, color: .blue) + // drawCircleAt(x: bottomRight.x, y: bottomRight.y, diameter: 10, color: .blue) + return WindowBounds(topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight) } }