Skip to content

Commit

Permalink
Re-grab input when automatic capture is enabled
Browse files Browse the repository at this point in the history
Make the window auto-capture the mouse again in full screen when it regains focus (for instance after swiping back to the UTM app).

fixes #6242
  • Loading branch information
haroldm committed Apr 12, 2024
1 parent db72c98 commit a308b50
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,24 @@ extension VMDisplayQemuMetalWindowController {
func windowDidEnterFullScreen(_ notification: Notification) {
isFullScreen = true
if isFullScreenAutoCapture {
captureMouseToolbarButton.state = .on
captureMouse()
}
}

func windowDidExitFullScreen(_ notification: Notification) {
isFullScreen = false
if isFullScreenAutoCapture {
captureMouseToolbarButton.state = .off
releaseMouse()
}
}

override func windowDidBecomeKey(_ notification: Notification) {
if isFullScreen && isFullScreenAutoCapture {
captureMouse()
}
super.windowDidBecomeKey(notification)
}

override func windowDidResignKey(_ notification: Notification) {
releaseMouse()
super.windowDidResignKey(notification)
Expand Down

0 comments on commit a308b50

Please sign in to comment.