Skip to content

Commit 78ad015

Browse files
authored
fix: Mouse cursor doesn't follow correctly when swapping windows (#1789)
1 parent edb5ed5 commit 78ad015

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Amethyst/Managers/ScreenManager.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ final class ScreenManager<Delegate: ScreenManagerDelegate>: NSObject, Codable {
238238
return
239239
}
240240

241+
let mouseFollowsFocus = userConfiguration.mouseFollowsFocus()
242+
241243
let completeOperation = BlockOperation()
242244

243245
// The complete operation should execute the completion delegate call
@@ -248,6 +250,12 @@ final class ScreenManager<Delegate: ScreenManagerDelegate>: NSObject, Codable {
248250

249251
DispatchQueue.main.async {
250252
self?.delegate?.onReflowCompletion()
253+
if mouseFollowsFocus {
254+
if case .windowSwap(let window, _) = event {
255+
window.focus()
256+
}
257+
}
258+
251259
}
252260
}
253261

Amethyst/Managers/WindowTransitionCoordinator.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ class WindowTransitionCoordinator<Target: WindowTransitionTarget> {
5959
guard let lastMainWindow = target?.lastMainWindowForCurrentSpace() else {
6060
return
6161
}
62-
target?.executeTransition(.switchWindows(focusedWindow, lastMainWindow))
63-
lastMainWindow.focus()
62+
target?.executeTransition(.switchWindows(lastMainWindow, focusedWindow))
6463
return
6564
}
6665

0 commit comments

Comments
 (0)