Skip to content

Commit

Permalink
Grid-based nav: jump to correct coordinates when Dock not auto-hidden.
Browse files Browse the repository at this point in the history
See #29: #29
  • Loading branch information
mjrusso committed Jul 18, 2022
1 parent 8f76439 commit 59f4fb1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Scoot/KeyboardInputWindow+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ extension KeyboardInputWindow {
for windowController in jumpWindowControllers {
if let screen = windowController.assignedScreen {
if screen.frame.contains(screenRect) {
let rect = NSRect( // Convert from screen coordinates to window coordinates.
x: screenRect.origin.x - screen.frame.origin.x,
y: screenRect.origin.y - screen.frame.origin.y,
// Convert from screen coordinates to window coordinates, accounting the system Dock (when visible).
let rect = NSRect(
x: screenRect.origin.x - screen.frame.origin.x - (screen.visibleFrame.origin.x - screen.frame.origin.x),
y: screenRect.origin.y - screen.frame.origin.y - (screen.visibleFrame.origin.y - screen.frame.origin.y),
width: screenRect.width,
height: screenRect.height
)
Expand Down
4 changes: 2 additions & 2 deletions Scoot/KeyboardInputWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class KeyboardInputWindow: TransparentWindow {
// screens are connected.)
let screenRects = grid.rects.map {
CGRect(
x: $0.origin.x + screen.frame.origin.x,
y: $0.origin.y + screen.frame.origin.y,
x: $0.origin.x + screen.visibleFrame.origin.x,
y: $0.origin.y + screen.visibleFrame.origin.y,
width: $0.width,
height: $0.height
)
Expand Down

0 comments on commit 59f4fb1

Please sign in to comment.