[Spice-devel] [PATCH spice-gtk 3/6] spice-gtk-session: rename update_keyboard_focus to request_auto_usbredir

Hans de Goede hdegoede at redhat.com
Tue Jun 26 01:32:36 PDT 2012


To better reflect what then function does, also rename the tracking variable
inside spice-gtk-session to match.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/spice-gtk-session-priv.h |    2 +-
 gtk/spice-gtk-session.c      |   16 ++++++++--------
 gtk/spice-widget.c           |    4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/gtk/spice-gtk-session-priv.h b/gtk/spice-gtk-session-priv.h
index 21a4251..fa4f002 100644
--- a/gtk/spice-gtk-session-priv.h
+++ b/gtk/spice-gtk-session-priv.h
@@ -22,7 +22,7 @@
 
 G_BEGIN_DECLS
 
-void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self,
+void spice_gtk_session_request_usb_autoredir(SpiceGtkSession *self,
                                              gboolean state);
 gboolean spice_gtk_session_get_read_only(SpiceGtkSession *self);
 
diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c
index 1d8c888..1df63f5 100644
--- a/gtk/spice-gtk-session.c
+++ b/gtk/spice-gtk-session.c
@@ -39,7 +39,7 @@ struct _SpiceGtkSessionPrivate {
     gboolean                clipboard_by_guest[CLIPBOARD_LAST];
     /* auto-usbredir related */
     gboolean                auto_usbredir_enable;
-    int                     keyboard_focus;
+    int                     auto_usbredir_reqs;
 };
 
 /**
@@ -235,7 +235,7 @@ static void spice_gtk_session_set_property(GObject      *gobject,
         break;
     case PROP_AUTO_USBREDIR:
         s->auto_usbredir_enable = g_value_get_boolean(value);
-        if (s->keyboard_focus) {
+        if (s->auto_usbredir_reqs) {
             SpiceUsbDeviceManager *manager =
                 spice_usb_device_manager_get(s->session, NULL);
 
@@ -837,7 +837,7 @@ static gboolean read_only(SpiceGtkSession *self)
 /* ---------------------------------------------------------------- */
 /* private functions (usbredir related)                             */
 G_GNUC_INTERNAL
-void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self,
+void spice_gtk_session_request_auto_usbredir(SpiceGtkSession *self,
                                              gboolean state)
 {
     g_return_if_fail(SPICE_IS_GTK_SESSION(self));
@@ -846,13 +846,13 @@ void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self,
     SpiceUsbDeviceManager *manager;
 
     if (state) {
-        s->keyboard_focus++;
-        if (s->keyboard_focus != 1)
+        s->auto_usbredir_reqs++;
+        if (s->auto_usbredir_reqs != 1)
             return;
     } else {
-        g_return_if_fail(s->keyboard_focus > 0);
-        s->keyboard_focus--;
-        if (s->keyboard_focus != 0)
+        g_return_if_fail(s->auto_usbredir_reqs > 0);
+        s->auto_usbredir_reqs--;
+        if (s->auto_usbredir_reqs != 0)
             return;
     }
 
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index d559273..8d13d4c 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1097,7 +1097,7 @@ static gboolean focus_in_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_UN
     sync_keyboard_lock_modifiers(display);
     d->keyboard_have_focus = true;
     try_keyboard_grab(display);
-    spice_gtk_session_update_keyboard_focus(d->gtk_session,
+    spice_gtk_session_request_usb_autoredir(d->gtk_session,
                                             d->keyboard_have_focus);
 #ifdef WIN32
     focus_window = GDK_WINDOW_HWND(gtk_widget_get_window(widget));
@@ -1122,7 +1122,7 @@ static gboolean focus_out_event(GtkWidget *widget, GdkEventFocus *focus G_GNUC_U
 
     release_keys(display);
     d->keyboard_have_focus = false;
-    spice_gtk_session_update_keyboard_focus(d->gtk_session,
+    spice_gtk_session_request_usb_autoredir(d->gtk_session,
                                             d->keyboard_have_focus);
     return true;
 }
-- 
1.7.10.4



More information about the Spice-devel mailing list