Skip to content

Commit ee3cb53

Browse files
committed
display(macOS): show capture info message on fullscreen capture
It may be confusing for new users that the mouse is captured. Resolves #5514
1 parent 78bc852 commit ee3cb53

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Platform/macOS/Display/VMDisplayQemuMetalWindowController.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class VMDisplayQemuMetalWindowController: VMDisplayQemuWindowController {
5959
// MARK: - User preferences
6060

6161
@Setting("NoCursorCaptureAlert") private var isCursorCaptureAlertShown: Bool = false
62+
@Setting("NoFullscreenCursorCaptureAlert") private var isFullscreenCursorCaptureAlertShown: Bool = false
6263
@Setting("DisplayFixed") private var isDisplayFixed: Bool = false
6364
@Setting("CtrlRightClick") private var isCtrlRightClick: Bool = false
6465
@Setting("AlternativeCaptureKey") private var isAlternativeCaptureKey: Bool = false
@@ -414,7 +415,7 @@ extension VMDisplayQemuMetalWindowController: VMMetalViewInputDelegate {
414415
self.window?.makeFirstResponder(self.metalView)
415416
self.syncCapsLock()
416417
}
417-
if isCursorCaptureAlertShown {
418+
if !isCursorCaptureAlertShown || (isFullScreen && !isFullscreenCursorCaptureAlertShown) {
418419
let alert = NSAlert()
419420
alert.messageText = NSLocalizedString("Captured mouse", comment: "VMDisplayQemuMetalWindowController")
420421

@@ -425,7 +426,10 @@ extension VMDisplayQemuMetalWindowController: VMMetalViewInputDelegate {
425426
alert.showsSuppressionButton = true
426427
alert.beginSheetModal(for: window!) { _ in
427428
if alert.suppressionButton?.state ?? .off == .on {
428-
self.isCursorCaptureAlertShown = false
429+
self.isCursorCaptureAlertShown = true
430+
if self.isFullScreen {
431+
self.isFullscreenCursorCaptureAlertShown = true
432+
}
429433
}
430434
DispatchQueue.main.async(execute: action)
431435
}

0 commit comments

Comments
 (0)