Signed-off-by: Matthew Francis <mjay.francis@xxxxxxxxx> --- doc/reference/spice-gtk-sections.txt | 11 ++ src/channel-main.c | 283 +++++++++++++++++++++++++++++++---- src/channel-main.h | 99 ++++++++---- src/map-file | 13 ++ src/spice-glib-sym-file | 13 ++ src/spice-gtk-session.c | 28 ++-- src/spice-widget.c | 13 +- tools/spicy.c | 27 ++-- 8 files changed, 396 insertions(+), 91 deletions(-) diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt index 0f5ec10..a85df7a 100644 --- a/doc/reference/spice-gtk-sections.txt +++ b/doc/reference/spice-gtk-sections.txt @@ -69,20 +69,31 @@ SpiceMainChannelClass spice_main_set_display spice_main_set_display_enabled spice_main_update_display +spice_main_channel_update_display spice_main_update_display_enabled +spice_main_channel_update_display_enabled spice_main_send_monitor_config +spice_main_channel_send_monitor_config spice_main_agent_test_capability +spice_main_channel_agent_test_capability spice_main_request_mouse_mode +spice_main_channel_request_mouse_mode spice_main_clipboard_selection_grab +spice_main_channel_clipboard_selection_grab spice_main_clipboard_selection_notify +spice_main_channel_clipboard_selection_notify spice_main_clipboard_selection_release +spice_main_channel_clipboard_selection_release spice_main_clipboard_selection_request +spice_main_channel_clipboard_selection_request spice_main_clipboard_grab spice_main_clipboard_release spice_main_clipboard_notify spice_main_clipboard_request spice_main_file_copy_async +spice_main_channel_file_copy_async spice_main_file_copy_finish +spice_main_channel_file_copy_finish <SUBSECTION Standard> SPICE_MAIN_CHANNEL SPICE_IS_MAIN_CHANNEL diff --git a/src/channel-main.c b/src/channel-main.c index dd78cad..3d682d6 100644 --- a/src/channel-main.c +++ b/src/channel-main.c @@ -1085,9 +1085,27 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors) * spice_main_set_display() and spice_main_set_display_enabled() * * Returns: %TRUE on success. + * + * Deprecated: 0.35: use spice_main_channel_send_monitor_config() instead. **/ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) { + return spice_main_channel_send_monitor_config(channel); +} + +/** + * spice_main_channel_send_monitor_config: + * @channel: a #SpiceMainChannel + * + * Send monitors configuration previously set with + * spice_main_set_display() and spice_main_set_display_enabled() + * + * Returns: %TRUE on success. + * + * Since: 0.35 + **/ +gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel) +{ SpiceMainChannelPrivate *c; VDAgentMonitorsConfig *mon; int i, j, monitors; @@ -1097,8 +1115,7 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) c = channel->priv; g_return_val_if_fail(c->agent_connected, FALSE); - if (spice_main_agent_test_capability(channel, - VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) { + if (spice_main_channel_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) { monitors = SPICE_N_ELEMENTS(c->display); } else { monitors = 0; @@ -1120,8 +1137,8 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel) j = 0; for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) { if (c->display[i].display_state != DISPLAY_ENABLED) { - if (spice_main_agent_test_capability(channel, - VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) + if (spice_main_channel_agent_test_capability(channel, + VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) j++; continue; } @@ -1497,7 +1514,7 @@ static gboolean timer_set_display(gpointer data) session = spice_channel_get_session(SPICE_CHANNEL(channel)); - if (!spice_main_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) { + if (!spice_main_channel_agent_test_capability(channel, VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) { /* ensure we have an explicit monitor configuration at least for number of display channels */ for (i = 0; i < spice_session_get_n_display_channels(session); i++) @@ -1506,7 +1523,7 @@ static gboolean timer_set_display(gpointer data) return FALSE; } } - spice_main_send_monitor_config(channel); + spice_main_channel_send_monitor_config(channel); return FALSE; } @@ -1587,9 +1604,26 @@ static void agent_stopped(SpiceMainChannel *channel) * when possible. * * Since: 0.32 + * Deprecated: 0.35: use spice_main_channel_request_mouse_mode() instead. **/ void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode) { + spice_main_channel_request_mouse_mode(channel, mode); +} + +/** + * spice_main_channel_request_mouse_mode: + * @channel: a %SpiceMainChannel + * @mode: a SPICE_MOUSE_MODE + * + * Request a mouse mode to the server. The server may not be able to + * change the mouse mode, but spice-gtk will try to request it + * when possible. + * + * Since: 0.35 + **/ +void spice_main_channel_request_mouse_mode(SpiceMainChannel *channel, int mode) +{ SpiceMsgcMainMouseModeRequest req = { .mode = mode, }; @@ -1623,7 +1657,7 @@ static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32 if (c->requested_mouse_mode != c->mouse_mode && c->requested_mouse_mode & supported) { - spice_main_request_mouse_mode(SPICE_MAIN_CHANNEL(channel), c->requested_mouse_mode); + spice_main_channel_request_mouse_mode(SPICE_MAIN_CHANNEL(channel), c->requested_mouse_mode); } } @@ -2567,9 +2601,27 @@ static void spice_main_handle_msg(SpiceChannel *channel, SpiceMsgIn *msg) * Test capability of a remote agent. * * Returns: %TRUE if @cap (channel kind capability) is available. + * + * Deprecated: 0.35: use spice_main_channel_agent_test_capability() instead. **/ gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap) { + return spice_main_channel_agent_test_capability(channel, cap); +} + +/** + * spice_main_channel_agent_test_capability: + * @channel: a #SpiceMainChannel + * @cap: an agent capability identifier + * + * Test capability of a remote agent. + * + * Returns: %TRUE if @cap (channel kind capability) is available. + * + * Since: 0.35 + **/ +gboolean spice_main_channel_agent_test_capability(SpiceMainChannel *channel, guint32 cap) +{ g_return_val_if_fail(SPICE_IS_MAIN_CHANNEL(channel), FALSE); return test_agent_cap(channel, cap); @@ -2591,11 +2643,38 @@ gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap * after 1 second without further changes. You can send when you want * without delay the new configuration to the remote with * spice_main_send_monitor_config() + * + * Deprecated: 0.35: use spice_main_channel_update_display() instead. **/ void spice_main_update_display(SpiceMainChannel *channel, int id, int x, int y, int width, int height, gboolean update) { + spice_main_channel_update_display(channel, id, x, y, width, height, update); +} + +/** + * spice_main_channel_update_display: + * @channel: a #SpiceMainChannel + * @id: display ID + * @x: x position + * @y: y position + * @width: display width + * @height: display height + * @update: if %TRUE, update guest resolution after 1sec. + * + * Update the display @id resolution. + * + * If @update is %TRUE, the remote configuration will be updated too + * after 1 second without further changes. You can send when you want + * without delay the new configuration to the remote with + * spice_main_send_monitor_config() + * + * Since: 0.35 + **/ +void spice_main_channel_update_display(SpiceMainChannel *channel, int id, int x, int y, int width, + int height, gboolean update) +{ SpiceMainChannelPrivate *c; g_return_if_fail(channel != NULL); @@ -2634,11 +2713,13 @@ void spice_main_update_display(SpiceMainChannel *channel, int id, * * Notify the guest of screen resolution change. The notification is * sent 1 second later, if no further changes happen. + * + * Deprecated: 0.35: use spice_main_channel_update_display() instead. **/ void spice_main_set_display(SpiceMainChannel *channel, int id, int x, int y, int width, int height) { - spice_main_update_display(channel, id, x, y, width, height, TRUE); + spice_main_channel_update_display(channel, id, x, y, width, height, TRUE); } /** @@ -2649,11 +2730,12 @@ void spice_main_set_display(SpiceMainChannel *channel, int id, * * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types. * - * Deprecated: 0.6: use spice_main_clipboard_selection_grab() instead. + * Deprecated: 0.6: use spice_main_channel_clipboard_selection_grab() instead. **/ void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes) { - spice_main_clipboard_selection_grab(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, types, ntypes); + spice_main_channel_clipboard_selection_grab(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, + types, ntypes); } /** @@ -2666,10 +2748,28 @@ void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int nt * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types. * * Since: 0.6 + * Deprecated: 0.35: use spice_main_channel_clipboard_selection_grab() instead. **/ void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, guint32 *types, int ntypes) { + spice_main_channel_clipboard_selection_grab(channel, selection, types, ntypes); +} + +/** + * spice_main_channel_clipboard_selection_grab: + * @channel: a #SpiceMainChannel + * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_* + * @types: an array of #VD_AGENT_CLIPBOARD types available in the clipboard + * @ntypes: the number of @types + * + * Grab the guest clipboard, with #VD_AGENT_CLIPBOARD @types. + * + * Since: 0.35 + **/ +void spice_main_channel_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, + guint32 *types, int ntypes) +{ g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); @@ -2684,11 +2784,11 @@ void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint select * Release the clipboard (for example, when the client loses the * clipboard grab): Inform the guest no clipboard data is available. * - * Deprecated: 0.6: use spice_main_clipboard_selection_release() instead. + * Deprecated: 0.6: use spice_main_channel_clipboard_selection_release() instead. **/ void spice_main_clipboard_release(SpiceMainChannel *channel) { - spice_main_clipboard_selection_release(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD); + spice_main_channel_clipboard_selection_release(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD); } /** @@ -2700,9 +2800,25 @@ void spice_main_clipboard_release(SpiceMainChannel *channel) * clipboard grab): Inform the guest no clipboard data is available. * * Since: 0.6 + * Deprecated: 0.35: use spice_main_channel_clipboard_selection_release() instead. **/ void spice_main_clipboard_selection_release(SpiceMainChannel *channel, guint selection) { + spice_main_channel_clipboard_selection_release(channel, selection); +} + +/** + * spice_main_channel_clipboard_selection_release: + * @channel: a #SpiceMainChannel + * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_* + * + * Release the clipboard (for example, when the client loses the + * clipboard grab): Inform the guest no clipboard data is available. + * + * Since: 0.35 + **/ +void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, guint selection) +{ g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); @@ -2724,13 +2840,13 @@ void spice_main_clipboard_selection_release(SpiceMainChannel *channel, guint sel * * Send the clipboard data to the guest. * - * Deprecated: 0.6: use spice_main_clipboard_selection_notify() instead. + * Deprecated: 0.6: use spice_main_channel_clipboard_selection_notify() instead. **/ void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size) { - spice_main_clipboard_selection_notify(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, - type, data, size); + spice_main_channel_clipboard_selection_notify(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, + type, data, size); } /** @@ -2744,10 +2860,29 @@ void spice_main_clipboard_notify(SpiceMainChannel *channel, * Send the clipboard data to the guest. * * Since: 0.6 + * Deprecated: 0.35: use spice_main_channel_clipboard_selection_notify() instead. **/ void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, guint32 type, const guchar *data, size_t size) { + spice_main_channel_clipboard_selection_notify(channel, selection, type, data, size); +} + +/** + * spice_main_channel_clipboard_selection_notify: + * @channel: a #SpiceMainChannel + * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_* + * @type: a #VD_AGENT_CLIPBOARD type + * @data: clipboard data + * @size: data length in bytes + * + * Send the clipboard data to the guest. + * + * Since: 0.35 + **/ +void spice_main_channel_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, + guint32 type, const guchar *data, size_t size) +{ g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); @@ -2763,11 +2898,12 @@ void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint sele * Request clipboard data of @type from the guest. The reply is sent * through the #SpiceMainChannel::main-clipboard signal. * - * Deprecated: 0.6: use spice_main_clipboard_selection_request() instead. + * Deprecated: 0.6: use spice_main_channel_clipboard_selection_request() instead. **/ void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type) { - spice_main_clipboard_selection_request(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, type); + spice_main_channel_clipboard_selection_request(channel, VD_AGENT_CLIPBOARD_SELECTION_CLIPBOARD, + type); } /** @@ -2780,9 +2916,27 @@ void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type) * through the #SpiceMainChannel::main-clipboard-selection signal. * * Since: 0.6 + * Deprecated: 0.35: use spice_main_channel_clipboard_selection_request() instead. **/ void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint selection, guint32 type) { + spice_main_channel_clipboard_selection_request(channel, selection, type); +} + +/** + * spice_main_channel_clipboard_selection_request: + * @channel: a #SpiceMainChannel + * @selection: one of the clipboard #VD_AGENT_CLIPBOARD_SELECTION_* + * @type: a #VD_AGENT_CLIPBOARD type + * + * Request clipboard data of @type from the guest. The reply is sent + * through the #SpiceMainChannel::main-clipboard-selection signal. + * + * Since: 0.35 + **/ +void spice_main_channel_clipboard_selection_request(SpiceMainChannel *channel, guint selection, + guint32 type) +{ g_return_if_fail(channel != NULL); g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); @@ -2807,8 +2961,34 @@ void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint sel * the value will be saved and used in the next configuration update. * * Since: 0.30 + * Deprecated: 0.35: use spice_main_channel_update_display_enabled() instead. **/ -void spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, gboolean update) +void spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, + gboolean update) +{ + spice_main_channel_update_display_enabled(channel, id, enabled, update); +} + +/** + * spice_main_channel_update_display_enabled: + * @channel: a #SpiceMainChannel + * @id: display ID (if -1: set all displays) + * @enabled: wether display @id is enabled + * @update: if %TRUE, update guest display state after 1sec. + * + * When sending monitor configuration to agent guest, if @enabled is %FALSE, + * don't set display @id, which the agent translates to disabling the display + * id. If @enabled is %TRUE, the monitor will be included in the next monitor + * update. Note: this will take effect next time the monitor configuration is + * sent. + * + * If @update is %FALSE, no server update will be triggered by this call, but + * the value will be saved and used in the next configuration update. + * + * Since: 0.35 + **/ +void spice_main_channel_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, + gboolean update) { SpiceDisplayState display_state = enabled ? DISPLAY_ENABLED : DISPLAY_DISABLED; g_return_if_fail(channel != NULL); @@ -2845,10 +3025,11 @@ void spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboole * configuration is sent. * * Since: 0.6 + * Deprecated: 0.35: use spice_main_channel_update_display_enabled() instead. **/ void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled) { - spice_main_update_display_enabled(channel, id, enabled, TRUE); + spice_main_channel_update_display_enabled(channel, id, enabled, TRUE); } static void file_xfer_init_task_async_cb(GObject *obj, GAsyncResult *res, gpointer data) @@ -3068,6 +3249,35 @@ static void file_transfer_operation_send_progress(SpiceFileTransferTask *xfer_ta * @callback: a #GAsyncReadyCallback to call when the request is satisfied * @user_data: the data to pass to callback function * + * See: spice_main_channel_file_copy_async() + * + * Deprecated: 0.35: use spice_main_channel_file_copy_async() instead. + **/ +void spice_main_file_copy_async(SpiceMainChannel *channel, + GFile **sources, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data) +{ + spice_main_channel_file_copy_async(channel, sources, flags, cancellable, progress_callback, + progress_callback_data, callback, user_data); +} + +/** + * spice_main_channel_file_copy_async: + * @channel: a #SpiceMainChannel + * @sources: (array zero-terminated=1): a %NULL-terminated array of #GFile objects to be transferred + * @flags: set of #GFileCopyFlags + * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore + * @progress_callback: (allow-none) (scope call): function to callback with + * progress information, or %NULL if progress information is not needed + * @progress_callback_data: (closure): user data to pass to @progress_callback + * @callback: a #GAsyncReadyCallback to call when the request is satisfied + * @user_data: the data to pass to callback function + * * Copies the file @sources to guest * * If @cancellable is not %NULL, then the operation can be cancelled by @@ -3092,15 +3302,16 @@ static void file_transfer_operation_send_progress(SpiceFileTransferTask *xfer_ta * progress_callback (above). If you need to monitor the ending of individual * files, you can connect to "finished" signal from each SpiceFileTransferTask. * + * Since: 0.35 **/ -void spice_main_file_copy_async(SpiceMainChannel *channel, - GFile **sources, - GFileCopyFlags flags, - GCancellable *cancellable, - GFileProgressCallback progress_callback, - gpointer progress_callback_data, - GAsyncReadyCallback callback, - gpointer user_data) +void spice_main_channel_file_copy_async(SpiceMainChannel *channel, + GFile **sources, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data) { SpiceMainChannelPrivate *c; FileTransferOperation *xfer_op; @@ -3172,6 +3383,24 @@ gboolean spice_main_file_copy_finish(SpiceMainChannel *channel, GAsyncResult *result, GError **error) { + return spice_main_channel_file_copy_finish(channel, result, error); +} + +/** + * spice_main_channel_file_copy_finish: + * @channel: a #SpiceMainChannel + * @result: a #GAsyncResult. + * @error: a #GError, or %NULL + * + * Finishes copying the file started with + * spice_main_file_copy_async(). + * + * Returns: a %TRUE on success, %FALSE on error. + **/ +gboolean spice_main_channel_file_copy_finish(SpiceMainChannel *channel, + GAsyncResult *result, + GError **error) +{ GTask *task = G_TASK(result); g_return_val_if_fail(SPICE_IS_MAIN_CHANNEL(channel), FALSE); diff --git a/src/channel-main.h b/src/channel-main.h index 2bb6d10..7650a03 100644 --- a/src/channel-main.h +++ b/src/channel-main.h @@ -71,44 +71,81 @@ struct _SpiceMainChannelClass { GType spice_main_channel_get_type(void); -void spice_main_set_display(SpiceMainChannel *channel, int id, - int x, int y, int width, int height); -void spice_main_update_display(SpiceMainChannel *channel, int id, - int x, int y, int width, int height, gboolean update); +void spice_main_channel_update_display(SpiceMainChannel *channel, int id, int x, int y, int width, + int height, gboolean update); +void spice_main_channel_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, + gboolean update); +gboolean spice_main_channel_send_monitor_config(SpiceMainChannel *channel); + +void spice_main_channel_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, + guint32 *types, int ntypes); +void spice_main_channel_clipboard_selection_release(SpiceMainChannel *channel, guint selection); +void spice_main_channel_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, + guint32 type, const guchar *data, size_t size); +void spice_main_channel_clipboard_selection_request(SpiceMainChannel *channel, guint selection, + guint32 type); + +gboolean spice_main_channel_agent_test_capability(SpiceMainChannel *channel, guint32 cap); +void spice_main_channel_file_copy_async(SpiceMainChannel *channel, + GFile **sources, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean spice_main_channel_file_copy_finish(SpiceMainChannel *channel, + GAsyncResult *result, + GError **error); + +void spice_main_channel_request_mouse_mode(SpiceMainChannel *channel, int mode); + +#ifndef SPICE_DISABLE_DEPRECATED +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_grab) +void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_release) +void spice_main_clipboard_release(SpiceMainChannel *channel); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_notify) +void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_request) +void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type); + +G_DEPRECATED_FOR(spice_main_channel_set_display) +void spice_main_set_display(SpiceMainChannel *channel, int id,int x, int y, int width, int height); +G_DEPRECATED_FOR(spice_main_update_display) +void spice_main_update_display(SpiceMainChannel *channel, int id, int x, int y, int width, + int height, gboolean update); +G_DEPRECATED_FOR(spice_main_channel_set_display_enabled) void spice_main_set_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled); -void spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, gboolean update); +G_DEPRECATED_FOR(spice_main_channel_update_display_enabled) +void spice_main_update_display_enabled(SpiceMainChannel *channel, int id, gboolean enabled, + gboolean update); +G_DEPRECATED_FOR(spice_main_channel_send_monitor_config) gboolean spice_main_send_monitor_config(SpiceMainChannel *channel); - -void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, guint32 *types, int ntypes); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_grab) +void spice_main_clipboard_selection_grab(SpiceMainChannel *channel, guint selection, guint32 *types, + int ntypes); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_release) void spice_main_clipboard_selection_release(SpiceMainChannel *channel, guint selection); -void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, guint32 type, const guchar *data, size_t size); -void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint selection, guint32 type); - +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_notify) +void spice_main_clipboard_selection_notify(SpiceMainChannel *channel, guint selection, guint32 type, + const guchar *data, size_t size); +G_DEPRECATED_FOR(spice_main_channel_clipboard_selection_request) +void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint selection, + guint32 type); +G_DEPRECATED_FOR(spice_main_channel_agent_test_capability) gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap); -void spice_main_file_copy_async(SpiceMainChannel *channel, - GFile **sources, - GFileCopyFlags flags, - GCancellable *cancellable, - GFileProgressCallback progress_callback, - gpointer progress_callback_data, - GAsyncReadyCallback callback, +G_DEPRECATED_FOR(spice_main_channel_file_copy_async) +void spice_main_file_copy_async(SpiceMainChannel *channel, GFile **sources, GFileCopyFlags flags, + GCancellable *cancellable, GFileProgressCallback progress_callback, + gpointer progress_callback_data, GAsyncReadyCallback callback, gpointer user_data); - -gboolean spice_main_file_copy_finish(SpiceMainChannel *channel, - GAsyncResult *result, +G_DEPRECATED_FOR(spice_main_channel_file_copy_finish) +gboolean spice_main_file_copy_finish(SpiceMainChannel *channel, GAsyncResult *result, GError **error); - +G_DEPRECATED_FOR(spice_main_channel_request_mouse_mode) void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode); - -#ifndef SPICE_DISABLE_DEPRECATED -G_DEPRECATED_FOR(spice_main_clipboard_selection_grab) -void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes); -G_DEPRECATED_FOR(spice_main_clipboard_selection_release) -void spice_main_clipboard_release(SpiceMainChannel *channel); -G_DEPRECATED_FOR(spice_main_clipboard_selection_notify) -void spice_main_clipboard_notify(SpiceMainChannel *channel, guint32 type, const guchar *data, size_t size); -G_DEPRECATED_FOR(spice_main_clipboard_selection_request) -void spice_main_clipboard_request(SpiceMainChannel *channel, guint32 type); #endif G_END_DECLS diff --git a/src/map-file b/src/map-file index 14e8ac6..3f2c158 100644 --- a/src/map-file +++ b/src/map-file @@ -80,7 +80,20 @@ spice_inputs_motion; spice_inputs_position; spice_inputs_set_key_locks; spice_main_agent_test_capability; +spice_main_channel_agent_test_capability; +spice_main_channel_clipboard_selection_grab; +spice_main_channel_clipboard_selection_notify; +spice_main_channel_clipboard_selection_release; +spice_main_channel_clipboard_selection_request; +spice_main_channel_file_copy_async; +spice_main_channel_file_copy_finish; spice_main_channel_get_type; +spice_main_channel_request_mouse_mode; +spice_main_channel_send_monitor_config; +spice_main_channel_set_display; +spice_main_channel_set_display_enabled; +spice_main_channel_update_display; +spice_main_channel_update_display_enabled; spice_main_clipboard_grab; spice_main_clipboard_notify; spice_main_clipboard_release; diff --git a/src/spice-glib-sym-file b/src/spice-glib-sym-file index 38e87e0..25be2a8 100644 --- a/src/spice-glib-sym-file +++ b/src/spice-glib-sym-file @@ -59,7 +59,20 @@ spice_inputs_motion spice_inputs_position spice_inputs_set_key_locks spice_main_agent_test_capability +spice_main_channel_agent_test_capability +spice_main_channel_clipboard_selection_grab +spice_main_channel_clipboard_selection_notify +spice_main_channel_clipboard_selection_release +spice_main_channel_clipboard_selection_request +spice_main_channel_file_copy_async +spice_main_channel_file_copy_finish spice_main_channel_get_type +spice_main_channel_request_mouse_mode +spice_main_channel_send_monitor_config +spice_main_channel_set_display +spice_main_channel_set_display_enabled +spice_main_channel_update_display +spice_main_channel_update_display_enabled spice_main_clipboard_grab spice_main_clipboard_notify spice_main_clipboard_release diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c index 6a53bf5..4e3393b 100644 --- a/src/spice-gtk-session.c +++ b/src/spice-gtk-session.c @@ -671,8 +671,8 @@ static void clipboard_get_targets(GtkClipboard *clipboard, s->clip_grabbed[selection] = TRUE; - if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) - spice_main_clipboard_selection_grab(s->main, selection, types, num_types); + if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + spice_main_channel_clipboard_selection_grab(s->main, selection, types, num_types); /* Sending a grab causes the agent to do an implicit release */ s->nclip_targets[selection] = 0; @@ -696,8 +696,8 @@ static void clipboard_owner_change(GtkClipboard *clipboard, if (s->clip_grabbed[selection]) { s->clip_grabbed[selection] = FALSE; - if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) - spice_main_clipboard_selection_release(s->main, selection); + if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_CLIPBOARD_BY_DEMAND)) + spice_main_channel_clipboard_selection_release(s->main, selection); } switch (event->reason) { @@ -741,7 +741,7 @@ static void clipboard_got_from_guest(SpiceMainChannel *main, guint selection, if (atom2agent[ri->info].vdagent == VD_AGENT_CLIPBOARD_UTF8_TEXT) { /* on windows, gtk+ would already convert to LF endings, but not on unix */ - if (spice_main_agent_test_capability(s->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { + if (spice_main_channel_agent_test_capability(s->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { conv = spice_dos2unix((gchar*)data, size); size = strlen(conv); } @@ -801,8 +801,8 @@ static void clipboard_get(GtkClipboard *clipboard, G_CALLBACK(clipboard_agent_connected), &ri); - spice_main_clipboard_selection_request(s->main, selection, - atom2agent[info].vdagent); + spice_main_channel_clipboard_selection_request(s->main, selection, + atom2agent[info].vdagent); g_object_get(s->main, "agent-connected", &agent_connected, NULL); @@ -921,7 +921,8 @@ static char *fixup_clipboard_text(SpiceGtkSession *self, const char *text, int * { char *conv = NULL; - if (spice_main_agent_test_capability(self->priv->main, VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { + if (spice_main_channel_agent_test_capability(self->priv->main, + VD_AGENT_CAP_GUEST_LINEEND_CRLF)) { conv = spice_unix2dos(text, *len); *len = strlen(conv); } else { @@ -976,10 +977,10 @@ static void clipboard_received_text_cb(GtkClipboard *clipboard, data = (const guchar *) (conv != NULL ? conv : text); notify_agent: - spice_main_clipboard_selection_notify(self->priv->main, selection, - VD_AGENT_CLIPBOARD_UTF8_TEXT, - data, - (data != NULL) ? len : 0); + spice_main_channel_clipboard_selection_notify(self->priv->main, selection, + VD_AGENT_CLIPBOARD_UTF8_TEXT, + data, + (data != NULL) ? len : 0); g_free(conv); } @@ -1032,8 +1033,7 @@ static void clipboard_received_cb(GtkClipboard *clipboard, */ g_warn_if_fail(type != VD_AGENT_CLIPBOARD_UTF8_TEXT); - spice_main_clipboard_selection_notify(s->main, selection, type, - data, len); + spice_main_channel_clipboard_selection_notify(s->main, selection, type, data, len); } static gboolean clipboard_request(SpiceMainChannel *main, guint selection, diff --git a/src/spice-widget.c b/src/spice-widget.c index 22d25c9..5365222 100644 --- a/src/spice-widget.c +++ b/src/spice-widget.c @@ -256,8 +256,7 @@ static void update_ready(SpiceDisplay *display) * application will manage the state of the displays. */ if (d->resize_guest_enable) { - spice_main_update_display_enabled(d->main, get_display_id(display), - ready, TRUE); + spice_main_channel_update_display_enabled(d->main, get_display_id(display), ready, TRUE); } if (d->ready == ready) @@ -514,7 +513,7 @@ static void file_transfer_callback(GObject *source_object, SpiceMainChannel *channel = SPICE_MAIN_CHANNEL(source_object); GError *error = NULL; - if (spice_main_file_copy_finish(channel, result, &error)) + if (spice_main_channel_file_copy_finish(channel, result, &error)) return; if (error != NULL && error->message != NULL) @@ -556,8 +555,8 @@ static void drag_data_received_callback(SpiceDisplay *self, } g_strfreev(file_urls); - spice_main_file_copy_async(d->main, files, 0, NULL, NULL, - NULL, file_transfer_callback, NULL); + spice_main_channel_file_copy_async(d->main, files, 0, NULL, NULL, NULL, file_transfer_callback, + NULL); for (i = 0; i < n_files; i++) { g_object_unref(files[i]); } @@ -1257,8 +1256,8 @@ static void recalc_geometry(GtkWidget *widget) d->ww, d->wh, zoom); if (d->resize_guest_enable) - spice_main_set_display(d->main, get_display_id(display), - d->area.x, d->area.y, d->ww / zoom, d->wh / zoom); + spice_main_channel_update_display(d->main, get_display_id(display), + d->area.x, d->area.y, d->ww / zoom, d->wh / zoom, TRUE); } /* ---------------------------------------------------------------- */ diff --git a/tools/spicy.c b/tools/spicy.c index 6ff6c9e..088e034 100644 --- a/tools/spicy.c +++ b/tools/spicy.c @@ -373,7 +373,7 @@ static void menu_cb_mouse_mode(GtkAction *action, void *data) else mode = SPICE_MOUSE_MODE_CLIENT; - spice_main_request_mouse_mode(cmain, mode); + spice_main_channel_request_mouse_mode(cmain, mode); } #ifdef USE_USBREDIR @@ -614,14 +614,17 @@ static void menu_cb_resize_to(GtkAction *action G_GNUC_UNUSED, gtk_widget_show_all(dialog); if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_APPLY) { - spice_main_update_display_enabled(win->conn->main, win->id + win->monitor_id, TRUE, FALSE); - spice_main_set_display(win->conn->main, - win->id + win->monitor_id, - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_x)), - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_y)), - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_width)), - gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_height))); - spice_main_send_monitor_config(win->conn->main); + spice_main_channel_update_display_enabled(win->conn->main, win->id + win->monitor_id, TRUE, + FALSE); + spice_main_channel_update_display( + win->conn->main, + win->id + win->monitor_id, + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_x)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_y)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_width)), + gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin_height)), + TRUE); + spice_main_channel_send_monitor_config(win->conn->main); } gtk_widget_destroy(dialog); } @@ -1437,10 +1440,10 @@ static void del_window(spice_connection *conn, SpiceWindow *win) g_debug("del display monitor %d:%d", win->id, win->monitor_id); conn->wins[win->id * CHANNELID_MAX + win->monitor_id] = NULL; if (win->id > 0) - spice_main_set_display_enabled(conn->main, win->id, FALSE); + spice_main_channel_update_display_enabled(conn->main, win->id, FALSE, TRUE); else - spice_main_set_display_enabled(conn->main, win->monitor_id, FALSE); - spice_main_send_monitor_config(conn->main); + spice_main_channel_update_display_enabled(conn->main, win->monitor_id, FALSE, TRUE); + spice_main_channel_send_monitor_config(conn->main); destroy_spice_window(win); } -- 2.7.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel