[Spice-devel] [PATCH spice-gtk 2/2] Take the grab when mouse switching to client mode

Marc-André Lureau marcandre.lureau at gmail.com
Fri Dec 9 08:03:20 PST 2011


Only when the widget has the focus and the pointer is over the widget
---
 gtk/spice-widget.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 3c2f6c0..e270c06 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1414,8 +1414,18 @@ static void mouse_update(SpiceChannel *channel, gpointer data)
     g_object_get(channel, "mouse-mode", &d->mouse_mode, NULL);
     SPICE_DEBUG("mouse mode %d", d->mouse_mode);
 
-    if (d->mouse_mode == SPICE_MOUSE_MODE_CLIENT)
+    switch (d->mouse_mode) {
+    case SPICE_MOUSE_MODE_CLIENT:
         try_mouse_ungrab(display);
+        break;
+    case SPICE_MOUSE_MODE_SERVER:
+        if (d->mouse_have_pointer &&
+            d->keyboard_have_focus)
+            try_mouse_grab(display);
+        break;
+    default:
+        g_warn_if_reached();
+    }
 
     update_mouse_pointer(display);
     cursor_invalidate(display);
-- 
1.7.7.3



More information about the Spice-devel mailing list