[Spice-devel,spice-gtk,Win32,6/7] Windows: spicy: listen to USB device plug/unplug events

Submitted by Uri Lublin on May 7, 2012, 1:15 p.m.

Details

Message ID 1336396539-9476-7-git-send-email-uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin May 7, 2012, 1:15 p.m.
---
 gtk/spicy.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Patch hide | download patch | download mbox

diff --git a/gtk/spicy.c b/gtk/spicy.c
index f44642f..4c9708b 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -1319,6 +1319,21 @@  static SpiceWindow *create_spice_window(spice_connection *conn, int id, SpiceCha

     gtk_widget_grab_focus(win->spice);

+
+#ifdef USE_USBREDIR
+#ifdef WIN32
+    SpiceUsbDeviceManager *manager = spice_usb_device_manager_get(conn->session,
+                                                                  NULL);
+    /* widget must be realized for geting its window */
+    gtk_widget_realize(win->toplevel);
+    GdkWindow *w = gtk_widget_get_window(win->toplevel);
+    /* Set window for receiving Windows device change notifications */
+    if (manager && w) {
+        spice_usb_device_manager_set_window(manager, w);
+    }
+#endif
+#endif
+
     return win;
 }