I think this was lost at some point when this was converted to Swift? There's still a lone focusedWindow.focus() in WindowTransitionCoordinator.swapFocusedWindowClockwise (but not in the other methods), but I think that solution no longer works due to the async nature of the new code. If you add focusedWindow.focus() calls to the other window transition methods, the mouse cursor gets updated to the last position before the transition, since the focus() call is sync and happens before the reflow.
I tried calling Window.currentlyFocused()?.focus() inside the reflow operation's completionBlock but that leads to some weird behavior where the focus is stuck to the currently focused window and you can't change it.
I think there's an additional bug that may be influencing this behavior in Window.isFocused. I set some breakpoints and inspected the values during reflow operations, and basically it always returns false. Changing the isEqual(to: focused) call to focused.windowID() == self.windowID() seems to do the right thing, or at least returns true when I expect it to.
System
What's the problem?
I think this was lost at some point when this was converted to Swift? There's still a lone focusedWindow.focus() in WindowTransitionCoordinator.swapFocusedWindowClockwise (but not in the other methods), but I think that solution no longer works due to the async nature of the new code. If you add focusedWindow.focus() calls to the other window transition methods, the mouse cursor gets updated to the last position before the transition, since the focus() call is sync and happens before the reflow.
I tried calling Window.currentlyFocused()?.focus() inside the reflow operation's completionBlock but that leads to some weird behavior where the focus is stuck to the currently focused window and you can't change it.
I think there's an additional bug that may be influencing this behavior in Window.isFocused. I set some breakpoints and inspected the values during reflow operations, and basically it always returns false. Changing the isEqual(to: focused) call to focused.windowID() == self.windowID() seems to do the right thing, or at least returns true when I expect it to.
See also #120 and #147.