vdagent/desktop_layout.cpp

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 8 10:34:22 UTC 2024


 vdagent/desktop_layout.cpp |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit d7405ee0850c34a9b4e09f0a0851d3e4408fad1a
Author: Benjamin Höglinger-Stelzer <nefarius at dhmx.at>
Date:   Fri Aug 30 01:07:55 2024 +0200

    Fixed issue with multiple GPUs causing mouse to not work (see https://www.spinics.net/lists/spice-devel/msg42936.html)

diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 07074da..8b538a1 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -48,6 +48,16 @@ DesktopLayout::~DesktopLayout()
     delete _display_config;
 }
 
+static BOOL
+dev_has_monitor(DISPLAY_DEVICE &dev_info)
+{
+    DISPLAY_DEVICE mon_info;
+
+    ZeroMemory(&mon_info, sizeof(mon_info));
+    mon_info.cb = sizeof(mon_info);
+    return EnumDisplayDevices(dev_info.DeviceName, 0, &mon_info, 0);
+}
+
 static bool
 get_next_display(DWORD &dev_id, DISPLAY_DEVICE &dev_info)
 {
@@ -64,6 +74,9 @@ get_next_display(DWORD &dev_id, DISPLAY_DEVICE &dev_info)
         if (wcsstr(dev_info.DeviceString, L"Citrix Indirect Display")) {
             continue;
         }
+        if (!dev_has_monitor(dev_info)) {
+            continue;
+        }
         return true;
     }
     return false;


More information about the Spice-commits mailing list