Bläddra i källkod

display: only show usb prompt when vm started

osy 3 år sedan
förälder
incheckning
b09c0bb653

+ 3 - 1
Platform/iOS/VMSessionState.swift

@@ -271,7 +271,9 @@ extension VMSessionState: CSUSBManagerDelegate {
     
     nonisolated func spiceUsbManager(_ usbManager: CSUSBManager, deviceAttached device: CSUSBDevice) {
         Task { @MainActor in
-            mostRecentConnectedDevice = device
+            if vmState == .vmStarted {
+                mostRecentConnectedDevice = device
+            }
             allUsbDevices.append(device)
         }
     }

+ 1 - 1
Platform/macOS/Display/VMDisplayQemuDisplayController.swift

@@ -329,7 +329,7 @@ extension VMDisplayQemuWindowController: CSUSBManagerDelegate {
         logger.debug("USB device attached: \(device)")
         if !isNoUsbPrompt {
             DispatchQueue.main.async {
-                if self.window!.isKeyWindow {
+                if self.window!.isKeyWindow && self.vm.state == .vmStarted {
                     self.showConnectPrompt(for: device)
                 }
             }