[Spice-commits] 2 commits - gtk/spice-widget.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Fri Dec 9 08:27:28 PST 2011


 gtk/spice-widget.c |   33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

New commits:
commit 5520091c24059ea05bf68f7bae42f9cbf18e7dff
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Dec 9 17:03:11 2011 +0100

    Take the grab when mouse switching to client mode
    
    Only when the widget has the focus and the pointer is over the widget

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);
commit e4047485709718aa4320c1c97137375d5b0a21a3
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Dec 9 16:31:45 2011 +0100

    Do not send ungrab key sequence to the server

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 9e45979..3c2f6c0 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -876,6 +876,16 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
             __FUNCTION__, key->type == GDK_KEY_PRESS ? "press" : "release",
             key->hardware_keycode, key->state, key->group);
 
+    if (check_for_grab_key(display, key->type, key->keyval) &&
+        d->mouse_mode == SPICE_MOUSE_MODE_SERVER) {
+        g_signal_emit(widget, signals[SPICE_DISPLAY_GRAB_KEY_PRESSED], 0);
+        if (d->mouse_grab_active)
+            try_mouse_ungrab(display);
+        else
+            try_mouse_grab(display);
+        return true;
+    }
+
     if (!d->inputs)
         return true;
 
@@ -892,17 +902,6 @@ static gboolean key_event(GtkWidget *widget, GdkEventKey *key)
         break;
     }
 
-    if (check_for_grab_key(display, key->type, key->keyval)) {
-        g_signal_emit(widget, signals[SPICE_DISPLAY_GRAB_KEY_PRESSED], 0);
-        if (d->mouse_grab_active)
-            try_mouse_ungrab(display);
-        else
-            /* TODO: gtk-vnc has a weird condition here
-               if (!d->grab_keyboard || !d->absolute) */
-            try_mouse_grab(display);
-    }
-
-
     return true;
 }
 


More information about the Spice-commits mailing list