[Spice-commits] 4 commits - server/dcc.h server/display-channel.c server/inputs-channel.c server/inputs-channel.h server/red-pipe-item.h server/reds.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Dec 19 16:30:24 UTC 2017


 server/dcc.h             |    2 +-
 server/display-channel.c |    7 +------
 server/inputs-channel.c  |   18 +++++++-----------
 server/inputs-channel.h  |    2 --
 server/red-pipe-item.h   |    8 ++++----
 server/reds.c            |    7 -------
 6 files changed, 13 insertions(+), 31 deletions(-)

New commits:
commit 52d8dd68984e23d5643e859e6dc5c03bfb9002c6
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Dec 12 17:20:39 2017 +0000

    inputs-channel: Move spice_server_kbd_leds to InputsChannel
    
    This avoids to expose some detail about the channel.
    Like other APIs implement it move close to the part that handle
    it instead of have everything in reds.c.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index 51e25969..3b2118f9 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -68,25 +68,20 @@ struct SpiceKbdState {
     /* track key press state */
     bool key[0x80];
     bool key_ext[0x80];
-    RedsState *reds;
+    InputsChannel *inputs;
 };
 
 static SpiceKbdInstance* inputs_channel_get_keyboard(InputsChannel *inputs);
 static SpiceMouseInstance* inputs_channel_get_mouse(InputsChannel *inputs);
 static SpiceTabletInstance* inputs_channel_get_tablet(InputsChannel *inputs);
 
-static SpiceKbdState* spice_kbd_state_new(RedsState *reds)
+static SpiceKbdState* spice_kbd_state_new(InputsChannel *inputs)
 {
     SpiceKbdState *st = g_new0(SpiceKbdState, 1);
-    st->reds = reds;
+    st->inputs = inputs;
     return st;
 }
 
-RedsState* spice_kbd_state_get_server(SpiceKbdState *dev)
-{
-    return dev->reds;
-}
-
 struct SpiceMouseState {
     int dummy;
 };
@@ -485,9 +480,10 @@ static void inputs_channel_push_keyboard_modifiers(InputsChannel *inputs, uint8_
                           red_inputs_key_modifiers_item_new(modifiers));
 }
 
-void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds)
+SPICE_GNUC_VISIBLE int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds)
 {
-    inputs_channel_push_keyboard_modifiers(inputs, leds);
+    inputs_channel_push_keyboard_modifiers(sin->st->inputs, leds);
+    return 0;
 }
 
 static void key_modifiers_sender(void *opaque)
@@ -615,7 +611,7 @@ int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboar
         return -1;
     }
     inputs->keyboard = keyboard;
-    inputs->keyboard->st = spice_kbd_state_new(red_channel_get_server(RED_CHANNEL(inputs)));
+    inputs->keyboard->st = spice_kbd_state_new(inputs);
     return 0;
 }
 
diff --git a/server/inputs-channel.h b/server/inputs-channel.h
index 1082d66c..945ba617 100644
--- a/server/inputs-channel.h
+++ b/server/inputs-channel.h
@@ -47,7 +47,6 @@ GType inputs_channel_get_type(void) G_GNUC_CONST;
 InputsChannel* inputs_channel_new(RedsState *reds);
 
 const VDAgentMouseState *inputs_channel_get_mouse_state(InputsChannel *inputs);
-void inputs_channel_on_keyboard_leds_change(InputsChannel *inputs, uint8_t leds);
 void inputs_channel_set_tablet_logical_size(InputsChannel *inputs, int x_res, int y_res);
 
 int inputs_channel_set_keyboard(InputsChannel *inputs, SpiceKbdInstance *keyboard);
@@ -56,7 +55,6 @@ int inputs_channel_set_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet
 int inputs_channel_has_tablet(InputsChannel *inputs);
 void inputs_channel_detach_tablet(InputsChannel *inputs, SpiceTabletInstance *tablet);
 RedsState* spice_tablet_state_get_server(SpiceTabletState *dev);
-RedsState* spice_kbd_state_get_server(SpiceKbdState *dev);
 gboolean inputs_channel_is_src_during_migrate(InputsChannel *inputs);
 void inputs_release_keys(InputsChannel *inputs);
 
diff --git a/server/reds.c b/server/reds.c
index 2b16c6d7..9102c512 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -4002,13 +4002,6 @@ SPICE_GNUC_VISIBLE int spice_server_add_renderer(SpiceServer *reds, const char *
     return 0;
 }
 
-SPICE_GNUC_VISIBLE int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds)
-{
-    RedsState *reds = spice_kbd_state_get_server(sin->st);
-    inputs_channel_on_keyboard_leds_change(reds->inputs_channel, leds);
-    return 0;
-}
-
 SPICE_GNUC_VISIBLE int spice_server_set_streaming_video(SpiceServer *reds, int value)
 {
     if (value != SPICE_STREAM_VIDEO_OFF &&
commit a793655a86727bd9a1701438c6279f50e75f6c4c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Dec 13 09:14:13 2017 +0000

    display-channel: Reuse GLIST_FOREACH macro in drawable_remove_from_pipes
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/display-channel.c b/server/display-channel.c
index 38a8a0e7..dae3eb75 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -441,17 +441,12 @@ static void current_remove_drawable(DisplayChannel *display, Drawable *item)
 static void drawable_remove_from_pipes(Drawable *drawable)
 {
     RedDrawablePipeItem *dpi;
-    GList *l;
 
-    l = drawable->pipes;
-    while (l) {
-        GList *next = l->next;
+    GLIST_FOREACH(drawable->pipes, RedDrawablePipeItem, dpi) {
         RedChannelClient *rcc;
 
-        dpi = l->data;
         rcc = RED_CHANNEL_CLIENT(dpi->dcc);
         red_channel_client_pipe_remove_and_release(rcc, &dpi->dpi_pipe_item);
-        l = next;
     }
 }
 
commit 5b5d9b1f510fde7d6dd841b6329d34110573adcc
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Dec 13 09:15:06 2017 +0000

    red-pipe-item: Move typedef at the top to avoid a "struct RedPipeItem"
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/red-pipe-item.h b/server/red-pipe-item.h
index f6bf68f0..8e911572 100644
--- a/server/red-pipe-item.h
+++ b/server/red-pipe-item.h
@@ -22,18 +22,18 @@
 #include <glib.h>
 #include <common/ring.h>
 
-struct RedPipeItem;
+typedef struct RedPipeItem RedPipeItem;
 
-typedef void red_pipe_item_free_t(struct RedPipeItem *item);
+typedef void red_pipe_item_free_t(RedPipeItem *item);
 
-typedef struct RedPipeItem {
+struct RedPipeItem {
     int type;
 
     /* private */
     int refcount;
 
     red_pipe_item_free_t *free_func;
-} RedPipeItem;
+};
 
 void red_pipe_item_init_full(RedPipeItem *item, int type, red_pipe_item_free_t free_func);
 RedPipeItem *red_pipe_item_ref(RedPipeItem *item);
commit f0d40082b03ccac8d3c38994a3c879ec9747127b
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Dec 13 09:13:25 2017 +0000

    dcc: Remove obsolete comment
    
    RedPipeItem does not contain a link anymore.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/server/dcc.h b/server/dcc.h
index a0399676..16d60ed0 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -124,7 +124,7 @@ typedef struct RedImageItem {
 } RedImageItem;
 
 typedef struct RedDrawablePipeItem {
-    RedPipeItem dpi_pipe_item; /* link for the client's pipe itself */
+    RedPipeItem dpi_pipe_item;
     Drawable *drawable;
     DisplayChannelClient *dcc;
 } RedDrawablePipeItem;


More information about the Spice-commits mailing list