[gnome-boxes] spice-display: Keep display alive if USB available



commit f84c6906108add6e6c9f4bb6fe73645af4602bc6
Author: Visarion Alexandru <viorel visarion gmail com>
Date:   Sun Jun 26 11:15:36 2016 +0300

    spice-display: Keep display alive if USB available
    
    The problem is that USB redirection is currently not available
    when VM connected through SPICE is in background mode.
    
    Let's keep the SPICE display alive if at least one USB device is
    available.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=744905

 src/spice-display.vala |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 96da823..a966e4f 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -170,22 +170,15 @@ private class Boxes.SpiceDisplay: Boxes.Display {
         return display;
     }
 
-    private bool has_usb_device_connected () {
+    public override bool should_keep_alive () {
         try {
             var manager = UsbDeviceManager.get (session);
-            var devs = manager.get_devices ();
-            for (int i = 0; i < devs.length; i++) {
-                var dev = devs[i];
-                if (manager.is_device_connected (dev))
-                    return true;
-            }
+            var devs = get_usb_devices (manager);
+
+            return (!closed && (devs.length > 0));
         } catch (GLib.Error error) {
+            return false;
         }
-        return false;
-    }
-
-    public override bool should_keep_alive () {
-        return !closed && has_usb_device_connected ();
     }
 
     public override void set_enable_audio (bool enable) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]