diff options
-rw-r--r-- | gtk/Makefile.am | 4 | ||||
-rw-r--r-- | gtk/channel-main.c | 67 | ||||
-rw-r--r-- | gtk/channel-main.h | 6 | ||||
-rw-r--r-- | gtk/spice-client-gtk-manual.defs | 2 | ||||
-rw-r--r-- | gtk/spice-widget.c | 4 |
5 files changed, 46 insertions, 37 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am index fd643e3..389f762 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -324,11 +324,13 @@ spice-client-gtk.defs: $(libspice_client_gtkinclude_HEADERS) $(libspice_client_g $(AM_V_GEN)$(PYTHON) $(CODEGENDIR)/h2def.py -f spice-client-gtk-manual.defs $(libspice_client_gtkinclude_HEADERS) $(libspice_client_glibinclude_HEADERS) > $@ spice-client-gtk-module.defs.c: spice-client-gtk.override spice-client-gtk.defs spice-client-gtk-manual.defs + @cat spice-client-gtk.defs spice-client-gtk-manual.defs > tmp.defs $(AM_V_GEN)pygobject-codegen-2.0 --prefix spice \ --register $(DEFSDIR)/gdk-types.defs \ --register $(DEFSDIR)/gtk-types.defs \ --override $(srcdir)/spice-client-gtk.override \ - spice-client-gtk.defs spice-client-gtk-manual.defs > $@ + tmp.defs > $@ + @rm tmp.defs CLEANFILES += spice-client-gtk.defs spice-client-gtk-module.defs.c EXTRA_DIST += spice-client-gtk.override spice-client-gtk-manual.defs spice-client-gtk.defs diff --git a/gtk/channel-main.c b/gtk/channel-main.c index 9316719..ce2c1b3 100644 --- a/gtk/channel-main.c +++ b/gtk/channel-main.c @@ -202,13 +202,13 @@ static void spice_main_channel_class_init(SpiceMainChannelClass *klass) /* ------------------------------------------------------------------ */ -static void agent_msg_send(SpiceChannel *channel, int type, int size, void *data) +static void agent_msg_send(SpiceMainChannel *channel, int type, int size, void *data) { spice_msg_out *out; VDAgentMessage *msg; void *payload; - out = spice_msg_out_new(channel, SPICE_MSGC_MAIN_AGENT_DATA); + out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_DATA); msg = (VDAgentMessage*) spice_marshaller_reserve_space(out->marshaller, sizeof(VDAgentMessage)); payload = (VDAgentMonitorsConfig*) @@ -224,9 +224,9 @@ static void agent_msg_send(SpiceChannel *channel, int type, int size, void *data spice_msg_out_unref(out); } -static void agent_monitors_config(SpiceChannel *channel) +static void agent_monitors_config(SpiceMainChannel *channel) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c = channel->priv; VDAgentMonitorsConfig *mon; int i, monitors = 1; size_t size; @@ -260,9 +260,9 @@ static void agent_monitors_config(SpiceChannel *channel) free(mon); } -static void agent_announce_caps(SpiceChannel *channel) +static void agent_announce_caps(SpiceMainChannel *channel) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c = channel->priv; VDAgentAnnounceCapabilities *caps; size_t size; @@ -281,9 +281,9 @@ static void agent_announce_caps(SpiceChannel *channel) free(caps); } -static void agent_clipboard_grab(SpiceChannel *channel, int *types, int ntypes) +static void agent_clipboard_grab(SpiceMainChannel *channel, int *types, int ntypes) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c = channel->priv; VDAgentClipboardGrab *grab; size_t size; int i; @@ -301,9 +301,9 @@ static void agent_clipboard_grab(SpiceChannel *channel, int *types, int ntypes) free(grab); } -static void agent_start(SpiceChannel *channel) +static void agent_start(SpiceMainChannel *channel) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c = channel->priv; SpiceMsgcMainAgentStart agent_start = { .num_tokens = ~0, }; @@ -313,7 +313,7 @@ static void agent_start(SpiceChannel *channel) c->agent_caps_received = false; g_signal_emit(channel, signals[SPICE_MAIN_AGENT_UPDATE], 0); - out = spice_msg_out_new(channel, SPICE_MSGC_MAIN_AGENT_START); + out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_START); out->marshallers->msgc_main_agent_start(out->marshaller, &agent_start); spice_msg_out_send(out); spice_msg_out_unref(out); @@ -322,7 +322,7 @@ static void agent_start(SpiceChannel *channel) agent_monitors_config(channel); } -static void agent_stopped(SpiceChannel *channel) +static void agent_stopped(SpiceMainChannel *channel) { spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; @@ -331,9 +331,9 @@ static void agent_stopped(SpiceChannel *channel) g_signal_emit(channel, signals[SPICE_MAIN_AGENT_UPDATE], 0); } -static void set_mouse_mode(SpiceChannel *channel, uint32_t supported, uint32_t current) +static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32_t current) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c = channel->priv; if (c->mouse_mode != current) { c->mouse_mode = current; @@ -346,7 +346,7 @@ static void set_mouse_mode(SpiceChannel *channel, uint32_t supported, uint32_t c .mode = SPICE_MOUSE_MODE_CLIENT, }; spice_msg_out *out; - out = spice_msg_out_new(channel, SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST); + out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST); out->marshallers->msgc_main_mouse_mode_request(out->marshaller, &req); spice_msg_out_send(out); spice_msg_out_unref(out); @@ -363,15 +363,16 @@ static void main_handle_init(SpiceChannel *channel, spice_msg_in *in) g_object_get(channel, "spice-session", &session, NULL); spice_session_set_connection_id(session, init->session_id); - out = spice_msg_out_new(channel, SPICE_MSGC_MAIN_ATTACH_CHANNELS); + out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_ATTACH_CHANNELS); spice_msg_out_send(out); spice_msg_out_unref(out); - set_mouse_mode(channel, init->supported_mouse_modes, init->current_mouse_mode); + set_mouse_mode(SPICE_MAIN_CHANNEL(channel), init->supported_mouse_modes, + init->current_mouse_mode); c->agent_tokens = init->agent_tokens; if (init->agent_connected) { - agent_start(channel); + agent_start(SPICE_MAIN_CHANNEL(channel)); } #if 0 @@ -404,17 +405,17 @@ static void main_handle_channels_list(SpiceChannel *channel, spice_msg_in *in) static void main_handle_mouse_mode(SpiceChannel *channel, spice_msg_in *in) { SpiceMsgMainMouseMode *msg = spice_msg_in_parsed(in); - set_mouse_mode(channel, msg->supported_modes, msg->current_mode); + set_mouse_mode(SPICE_MAIN_CHANNEL(channel), msg->supported_modes, msg->current_mode); } static void main_handle_agent_connected(SpiceChannel *channel, spice_msg_in *in) { - agent_start(channel); + agent_start(SPICE_MAIN_CHANNEL(channel)); } static void main_handle_agent_disconnected(SpiceChannel *channel, spice_msg_in *in) { - agent_stopped(channel); + agent_stopped(SPICE_MAIN_CHANNEL(channel)); } static void main_handle_agent_data(SpiceChannel *channel, spice_msg_in *in) @@ -462,7 +463,7 @@ complete: c->agent_caps_received = true; g_signal_emit(channel, signals[SPICE_MAIN_AGENT_UPDATE], 0); if (caps->request) - agent_announce_caps(channel); + agent_announce_caps(SPICE_MAIN_CHANNEL(channel)); } case VD_AGENT_REPLY: { @@ -512,18 +513,20 @@ static gboolean timer_set_display(gpointer data) spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; c->timer_id = 0; - agent_monitors_config(channel); + agent_monitors_config(SPICE_MAIN_CHANNEL(channel)); return false; } -void spice_main_set_display(SpiceChannel *channel, int id, +void spice_main_set_display(SpiceMainChannel *channel, int id, int x, int y, int width, int height) { - spice_main_channel *c = SPICE_MAIN_CHANNEL(channel)->priv; + spice_main_channel *c; - if (id >= SPICE_N_ELEMENTS(c->display)) { - return; - } + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + + c = SPICE_MAIN_CHANNEL(channel)->priv; + + g_return_if_fail(id < SPICE_N_ELEMENTS(c->display)); c->display[id].x = x; c->display[id].y = y; @@ -536,12 +539,16 @@ void spice_main_set_display(SpiceChannel *channel, int id, c->timer_id = g_timeout_add_seconds(1, timer_set_display, channel); } -void spice_main_clipboard_grab(SpiceChannel *channel, int *types, int ntypes) +void spice_main_clipboard_grab(SpiceMainChannel *channel, int *types, int ntypes) { + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + agent_clipboard_grab(channel, types, ntypes); } -void spice_main_clipboard_release(SpiceChannel *channel) +void spice_main_clipboard_release(SpiceMainChannel *channel) { + g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); + g_warning("%s: TODO", __FUNCTION__); } diff --git a/gtk/channel-main.h b/gtk/channel-main.h index 0eb00b2..03a9ebb 100644 --- a/gtk/channel-main.h +++ b/gtk/channel-main.h @@ -51,11 +51,11 @@ struct _SpiceMainChannelClass { GType spice_main_channel_get_type(void); -void spice_main_set_display(SpiceChannel *channel, int id, +void spice_main_set_display(SpiceMainChannel *channel, int id, int x, int y, int width, int height); -void spice_main_clipboard_grab(SpiceChannel *channel, int *types, int ntypes); -void spice_main_clipboard_release(SpiceChannel *channel); +void spice_main_clipboard_grab(SpiceMainChannel *channel, int *types, int ntypes); +void spice_main_clipboard_release(SpiceMainChannel *channel); G_END_DECLS diff --git a/gtk/spice-client-gtk-manual.defs b/gtk/spice-client-gtk-manual.defs index c8f4c6d..1d4bc4e 100644 --- a/gtk/spice-client-gtk-manual.defs +++ b/gtk/spice-client-gtk-manual.defs @@ -88,7 +88,7 @@ ) ) -(define-method spice_inputs_set_key_locks +(define-method set_key_locks (of-object "SpiceInputsChannel") (c-name "spice_inputs_set_key_locks") (return-type "none") diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c index b84a321..2329b73 100644 --- a/gtk/spice-widget.c +++ b/gtk/spice-widget.c @@ -64,7 +64,7 @@ struct spice_display { bool clip_grabbed; SpiceSession *session; - SpiceChannel *main; + SpiceMainChannel *main; SpiceChannel *display; SpiceCursorChannel *cursor; SpiceInputsChannel *inputs; @@ -1542,7 +1542,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data) g_object_get(channel, "channel-id", &id, NULL); if (SPICE_IS_MAIN_CHANNEL(channel)) { - d->main = channel; + d->main = SPICE_MAIN_CHANNEL(channel); g_signal_connect(channel, "main-mouse-update", G_CALLBACK(mouse_update), display); mouse_update(channel, display); |