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

Submitted by Hans de Goede on June 26, 2012, 8:32 a.m.

Details

Message ID 1340699559-11564-3-git-send-email-hdegoede@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Hans de Goede June 26, 2012, 8:32 a.m.
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@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(-)

Patch hide | download patch | download mbox

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;
 }

Comments

On Tue, Jun 26, 2012 at 10:32 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> +void spice_gtk_session_request_auto_usbredir(SpiceGtkSession *self,
>                                              gboolean state)

You need to fix the naming, or compilation fails here:

./.libs/libspice-client-gtk-3.0.so: undefined reference to
`spice_gtk_session_request_usb_autoredir'
Hi,

On 06/26/2012 11:42 AM, Marc-André Lureau wrote:
> On Tue, Jun 26, 2012 at 10:32 AM, Hans de Goede <hdegoede@redhat.com> wrote:
>> +void spice_gtk_session_request_auto_usbredir(SpiceGtkSession *self,
>>                                               gboolean state)
>
> You need to fix the naming, or compilation fails here:
>
> ./.libs/libspice-client-gtk-3.0.so: undefined reference to
> `spice_gtk_session_request_usb_autoredir'

Bummer, I did fixup the naming already but I squashed it into the wrong
patch :|

I'll send a new version of the set including a fix for the app-name issue.

Regards,

Hans