Swindler icon indicating copy to clipboard operation
Swindler copied to clipboard

Setting frame can result unexpected coordinates

Open romadryud opened this issue 2 years ago • 2 comments

Following code will produce following logs when created window goes off the screen:

print("addWindow x: \(newWindowSizes.x)")
setWindow(window: window, x: newWindowSizes.x, y: newWindowSizes.y, width: newWindowSizes.width, height: newWindowSizes.height)
        .done { newRect in
          self.windows.append(window)
          self.newWindowSizes.x = newRect.maxX
          print("new window created at minX: \(newRect.minX)")
        }
addWindow x: 3840.0
setWindow: 3840.0 1280.0
Frame changed from (1280.0, 0.0, 1280.0, 1055.0) to (3800.0, 0.0, 1280.0, 1055.0), external: false
new window created at minX: 3800.0

setWindow is just wrapper for window.frame.set(rect)

How I can debug this behaviour?

romadryud avatar Apr 02 '23 14:04 romadryud

@tmandry do you have any thoughts?

romadryud avatar Apr 30 '23 18:04 romadryud

Usually the accessibility APIs don't allow moving a window off-screen. (It is up to the application who owns the window to decide how to respond to the request, and by default it clamps the input so enough of the window remains on-screen.)

tmandry avatar May 01 '23 20:05 tmandry