diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45a2fae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/spice-gtk-0.38.tar.xz +SOURCES/victortoso-E37A484F.keyring diff --git a/.spice-gtk.metadata b/.spice-gtk.metadata new file mode 100644 index 0000000..9afc954 --- /dev/null +++ b/.spice-gtk.metadata @@ -0,0 +1,2 @@ +2d378aaeaecd0cb35c43b9ab216df840060d1baa SOURCES/spice-gtk-0.38.tar.xz +da7a529db1ea28a1540c5892ea9836abeb378c3e SOURCES/victortoso-E37A484F.keyring diff --git a/SOURCES/0001-channel-main-Avoid-macro-side-effects.patch b/SOURCES/0001-channel-main-Avoid-macro-side-effects.patch new file mode 100644 index 0000000..dabb8ad --- /dev/null +++ b/SOURCES/0001-channel-main-Avoid-macro-side-effects.patch @@ -0,0 +1,34 @@ +From d8922b93f52d08fb81cc66842b4df80d1d1d9a7e Mon Sep 17 00:00:00 2001 +From: Frediano Ziglio +Date: Thu, 19 Mar 2020 15:50:45 +0000 +Subject: [PATCH 1/9] channel-main: Avoid macro side effects + +In big endian system GUINT32_TO_LE macro uses the parameter +multiple time causing serial to be incremented multiple times +instead of one. +Avoid side effects using a temporary variable. + +Signed-off-by: Frediano Ziglio +Acked-by: Victor Toso +(cherry picked from commit 7363d1a0a640b6992d5967621e37c3376958d708) +--- + src/channel-main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/channel-main.c b/src/channel-main.c +index 1e85a36..e89b813 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -1384,7 +1384,8 @@ static void agent_clipboard_grab(SpiceMainChannel *channel, guint selection, + } + + if (test_agent_cap(channel, VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) { +- *(uint32_t *)grab = GUINT32_TO_LE(c->clipboard_serial[selection]++); ++ uint32_t serial = c->clipboard_serial[selection]++; ++ *(uint32_t *)grab = GUINT32_TO_LE(serial); + grab = (void *)grab + sizeof(uint32_t); + } + +-- +2.26.2 + diff --git a/SOURCES/0002-channel-main-Check-proper-size-and-caps-handling-VD_.patch b/SOURCES/0002-channel-main-Check-proper-size-and-caps-handling-VD_.patch new file mode 100644 index 0000000..8383ad7 --- /dev/null +++ b/SOURCES/0002-channel-main-Check-proper-size-and-caps-handling-VD_.patch @@ -0,0 +1,77 @@ +From 5324e83bf636b995522088d508e61ba5543777f4 Mon Sep 17 00:00:00 2001 +From: Frediano Ziglio +Date: Thu, 19 Mar 2020 06:07:39 +0000 +Subject: [PATCH 2/9] channel-main: Check proper size and caps handling + VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE + +VDAgentFileXferStatusMessage message can or cannot contain detailed +information attached to it. +Detect this correctly checking capabilities and flags. +This fixes a small buffer overflow reading in case the details are +off the payload. + +Signed-off-by: Frediano Ziglio +Acked-by: Victor Toso +(cherry picked from commit b13fd0664075c951f5418f5828c0803408ad664d) +--- + meson.build | 2 +- + src/channel-main.c | 16 +++++++++++++--- + 2 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/meson.build b/meson.build +index 995268b..8098989 100644 +--- a/meson.build ++++ b/meson.build +@@ -81,7 +81,7 @@ endforeach + # + # check for mandatory dependencies + # +-spice_protocol_version='>= 0.14.1' ++spice_protocol_version='>= 0.14.2' + + glib_version = '2.46' + glib_version_info = '>= @0@'.format(glib_version) +diff --git a/src/channel-main.c b/src/channel-main.c +index e89b813..c4fe02b 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -1891,6 +1891,7 @@ static void file_xfer_read_async_cb(GObject *source_object, + + /* coroutine context */ + static void main_agent_handle_xfer_status(SpiceMainChannel *channel, ++ const VDAgentMessage *msg_hdr, + VDAgentFileXferStatusMessage *msg) + { + SpiceFileTransferTask *xfer_task; +@@ -1917,8 +1918,17 @@ static void main_agent_handle_xfer_status(SpiceMainChannel *channel, + _("The spice agent reported an error during the file transfer")); + break; + case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE: { +- uint64_t *free_space = SPICE_ALIGNED_CAST(uint64_t *, msg->data); +- gchar *free_space_str = g_format_size(*free_space); ++ const VDAgentFileXferStatusNotEnoughSpace *err = ++ (VDAgentFileXferStatusNotEnoughSpace*) msg->data; ++ if (!test_agent_cap(channel, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS) || ++ msg_hdr->size < sizeof(*msg) + sizeof(*err)) { ++ error = ++ g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, ++ _("File transfer failed due to lack of free space on remote machine")); ++ break; ++ } ++ ++ gchar *free_space_str = g_format_size(err->disk_free_space); + gchar *file_size_str = g_format_size(spice_file_transfer_task_get_total_bytes(xfer_task)); + error = g_error_new(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("File transfer failed due to lack of free space on remote machine " +@@ -2110,7 +2120,7 @@ static void main_agent_handle_msg(SpiceChannel *channel, + break; + } + case VD_AGENT_FILE_XFER_STATUS: +- main_agent_handle_xfer_status(self, payload); ++ main_agent_handle_xfer_status(self, msg, payload); + break; + default: + g_warning("unhandled agent message type: %u (%s), size %u", +-- +2.26.2 + diff --git a/SOURCES/0003-build-sys-bump-polkit-requirement-to-0.101.patch b/SOURCES/0003-build-sys-bump-polkit-requirement-to-0.101.patch new file mode 100644 index 0000000..991d977 --- /dev/null +++ b/SOURCES/0003-build-sys-bump-polkit-requirement-to-0.101.patch @@ -0,0 +1,94 @@ +From f036039b2ab3945940159342fb3880064f2611c9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +Date: Thu, 9 Apr 2020 01:05:00 +0200 +Subject: [PATCH 3/9] build-sys: bump polkit requirement to 0.101 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It was released on 2011-03-03, and is available in old debian stable +and all distros we care about. + +Signed-off-by: Marc-André Lureau +Acked-by: Frediano Ziglio +(cherry picked from commit 94a3375beff5df8c8add33cf2f1b74350185dce2) +--- + meson.build | 7 +----- + src/spice-client-glib-usb-acl-helper.c | 34 -------------------------- + 2 files changed, 1 insertion(+), 40 deletions(-) + +diff --git a/meson.build b/meson.build +index 8098989..c442a0d 100644 +--- a/meson.build ++++ b/meson.build +@@ -204,14 +204,9 @@ endif + + # polkit + spice_gtk_has_polkit = false +-d = dependency('polkit-gobject-1', version : '>= 0.96', required : get_option('polkit')) ++d = dependency('polkit-gobject-1', version : '>= 0.101', required : get_option('polkit')) + if d.found() + spice_gtk_policy_dir = d.get_pkgconfig_variable('policydir') +- foreach func : ['polkit_authority_get_sync', 'polkit_authorization_result_get_dismissed'] +- if compiler.has_function(func, dependencies : d) +- spice_gtk_config_data.set('HAVE_@0@'.format(func.to_upper()), '1') +- endif +- endforeach + + # TODO: With 'auto', we should just disable polkit support if this is missing. + if not compiler.has_function('acl_get_file') +diff --git a/src/spice-client-glib-usb-acl-helper.c b/src/spice-client-glib-usb-acl-helper.c +index f75e0fc..de9e605 100644 +--- a/src/spice-client-glib-usb-acl-helper.c ++++ b/src/spice-client-glib-usb-acl-helper.c +@@ -156,25 +156,6 @@ static void cleanup(void) + g_main_loop_quit(loop); + } + +-/* Not available in polkit < 0.101 */ +-#ifndef HAVE_POLKIT_AUTHORIZATION_RESULT_GET_DISMISSED +-static gboolean +-polkit_authorization_result_get_dismissed(PolkitAuthorizationResult *result) +-{ +- gboolean ret; +- PolkitDetails *details; +- +- g_return_val_if_fail(POLKIT_IS_AUTHORIZATION_RESULT(result), FALSE); +- +- ret = FALSE; +- details = polkit_authorization_result_get_details(result); +- if (details != NULL && polkit_details_lookup(details, "polkit.dismissed")) +- ret = TRUE; +- +- return ret; +-} +-#endif +- + static void check_authorization_cb(PolkitAuthority *authority, + GAsyncResult *res, gpointer data) + { +@@ -291,21 +272,6 @@ static void stdin_read_complete(GObject *src, GAsyncResult *res, gpointer data) + g_free(s); + } + +-/* Fix for polkit 0.97 and later */ +-#ifndef HAVE_POLKIT_AUTHORITY_GET_SYNC +-static PolkitAuthority * +-polkit_authority_get_sync (GCancellable *cancellable, GError **error) +-{ +- PolkitAuthority *authority; +- +- authority = polkit_authority_get (); +- if (!authority) +- g_set_error (error, 0, 0, "failed to get the PolicyKit authority"); +- +- return authority; +-} +-#endif +- + #ifndef HAVE_CLEARENV + extern char **environ; + +-- +2.26.2 + diff --git a/SOURCES/0004-spice-channel-Read-all-available-data-from-SASL-buff.patch b/SOURCES/0004-spice-channel-Read-all-available-data-from-SASL-buff.patch new file mode 100644 index 0000000..d703a6b --- /dev/null +++ b/SOURCES/0004-spice-channel-Read-all-available-data-from-SASL-buff.patch @@ -0,0 +1,47 @@ +From 1562755fd60ae79d595dd8be0d1ddf5b784729c2 Mon Sep 17 00:00:00 2001 +From: Gilmar Santos Jr +Date: Wed, 6 May 2020 12:58:51 -0300 +Subject: [PATCH 4/9] spice-channel: Read all available data from SASL buffer + +When SASL is in use, its buffer may contain remaining data from previously +received messages. The spice_channel_iterate_read should use it, even if c->in +socket is not readable. + +Fixes: https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/126 + +Acked-by: Frediano Ziglio +(cherry picked from commit 80e9c852a406d93cad3fc7b845fe181d75356f11) +--- + src/spice-channel.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/src/spice-channel.c b/src/spice-channel.c +index 315e287..5824fdd 100644 +--- a/src/spice-channel.c ++++ b/src/spice-channel.c +@@ -2345,16 +2345,15 @@ static void spice_channel_iterate_read(SpiceChannel *channel) + /* treat all incoming data (block on message completion) */ + while (!c->has_error && + c->state != SPICE_CHANNEL_STATE_MIGRATING && +- g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(c->in)) +- ) { do +- spice_channel_recv_msg(channel, +- (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL); ++ (g_pollable_input_stream_is_readable(G_POLLABLE_INPUT_STREAM(c->in)) + #ifdef HAVE_SASL + /* flush the sasl buffer too */ +- while (c->sasl_decoded != NULL); +-#else +- while (FALSE); ++ || c->sasl_decoded != NULL + #endif ++ ) ++ ) { ++ spice_channel_recv_msg(channel, ++ (handler_msg_in)SPICE_CHANNEL_GET_CLASS(channel)->handle_msg, NULL); + } + + } +-- +2.26.2 + diff --git a/SOURCES/0005-meson-add-wayland-protocols.patch b/SOURCES/0005-meson-add-wayland-protocols.patch new file mode 100644 index 0000000..c9e8f73 --- /dev/null +++ b/SOURCES/0005-meson-add-wayland-protocols.patch @@ -0,0 +1,160 @@ +From 8d3731162c2b3aae518f8d8b2d7190c4deec9911 Mon Sep 17 00:00:00 2001 +From: Francesco Giudici +Date: Thu, 27 Feb 2020 11:55:15 +0100 +Subject: [PATCH 5/9] meson: add wayland protocols + +Generate wayland protocols: these will be used later for locking the +mouse pointer and getting relative mouse movements when using the mouse +in server mode in Wayland. +The meson build steps have been freely taken and adapted from Weston +source code: +https://gitlab.freedesktop.org/wayland/weston/-/blob/master/protocol/meson.build + +Signed-off-by: Francesco Giudici +Acked-by: Frediano Ziglio +(cherry picked from commit d70044ab49728524c68796dd371d2bf7d94d27e5) +--- + meson.build | 20 +++++++++++++++ + meson_options.txt | 4 +++ + src/meson.build | 62 +++++++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 84 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index c442a0d..7426ea5 100644 +--- a/meson.build ++++ b/meson.build +@@ -31,6 +31,7 @@ spice_gtk_config_data = configuration_data() + spice_gtk_include = [include_directories('.')] + spice_glib_deps = [] + spice_gtk_deps = [] ++spice_wayland_deps = [] + spice_acl_deps = [] + + # +@@ -152,6 +153,25 @@ if d.found() + spice_gtk_has_gtk = true + endif + ++# wayland protocols ++spice_gtk_has_wayland_protocols = false ++# Check if gtk is enabled and supports the wayland backend ++if host_machine.system() != 'windows' and spice_gtk_has_gtk and compiler.has_header('gtk-3.0/gdk/gdkwayland.h') ++ d = dependency('wayland-protocols', version: '>= 1.17', required: get_option('wayland-protocols')) ++ if d.found() ++ spice_gtk_config_data.set('HAVE_WAYLAND_PROTOCOLS', '1') ++ dir_wp_base = d.get_pkgconfig_variable('pkgdatadir') ++ dep_scanner = dependency('wayland-scanner', native: true) ++ prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner')) ++ ++ wayland_libs_version_required = '1.17.0' ++ spice_wayland_deps += dependency('wayland-server', version : '>= @0@'.format(wayland_libs_version_required)) ++ spice_wayland_deps += dependency('wayland-cursor', version : '>= @0@'.format(wayland_libs_version_required)) ++ spice_wayland_deps += dependency('wayland-client', version : '>= @0@'.format(wayland_libs_version_required)) ++ spice_gtk_has_wayland_protocols = true ++ endif ++endif ++ + # webdav + spice_gtk_has_phodav = false + d = dependency('libphodav-2.0', required: get_option('webdav')) +diff --git a/meson_options.txt b/meson_options.txt +index 9804217..60b87ca 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -2,6 +2,10 @@ option('gtk', + type : 'feature', + description: 'Enable gtk+') + ++option('wayland-protocols', ++ type : 'feature', ++ description: 'Enable wayland protocols') ++ + option('webdav', + type : 'feature', + description: 'Enable webdav support') +diff --git a/src/meson.build b/src/meson.build +index 654dab5..bdd2239 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -318,6 +318,64 @@ if spice_gtk_has_gtk + command : cmd) + endforeach + ++ # ++ # Wayland protocols ++ # ++ if spice_gtk_has_wayland_protocols ++ ++ generated_protocols = [ ++ [ 'pointer-constraints', 'v1' ], ++ [ 'relative-pointer', 'v1' ], ++ #[ 'input-method', 'v1' ], ++ #[ 'input-timestamps', 'v1' ], ++ #[ 'fullscreen-shell', 'v1' ], ++ #[ 'linux-dmabuf', 'v1' ], ++ #[ 'linux-explicit-synchronization', 'v1' ], ++ #[ 'presentation-time', 'stable' ], ++ #[ 'tablet', 'v2' ], ++ #[ 'text-input', 'v1' ], ++ #[ 'viewporter', 'stable' ], ++ #[ 'xdg-output', 'v1' ], ++ #[ 'xdg-shell', 'v6' ], ++ #[ 'xdg-shell', 'stable' ], ++ ] ++ ++ foreach proto: generated_protocols ++ proto_name = proto[0] ++ if proto[1] == 'internal' ++ base_file = proto_name ++ xml_path = '@0@.xml'.format(proto_name) ++ elif proto[1] == 'stable' ++ base_file = proto_name ++ xml_path = '@0@/stable/@1@/@1@.xml'.format(dir_wp_base, base_file) ++ else ++ base_file = '@0@-unstable-@1@'.format(proto_name, proto[1]) ++ xml_path = '@0@/unstable/@1@/@2@.xml'.format(dir_wp_base, proto_name, base_file) ++ endif ++ ++ foreach output_type: [ 'client-header', 'server-header', 'private-code' ] ++ if output_type == 'client-header' ++ output_file = '@0@-client-protocol.h'.format(base_file) ++ elif output_type == 'server-header' ++ output_file = '@0@-server-protocol.h'.format(base_file) ++ else ++ output_file = '@0@-protocol.c'.format(base_file) ++ if dep_scanner.version().version_compare('< 1.14.91') ++ output_type = 'code' ++ endif ++ endif ++ ++ spice_client_gtk_sources += custom_target( ++ '@0@ @1@'.format(base_file, output_type), ++ command: [ prog_scanner, output_type, '@INPUT@', '@OUTPUT@' ], ++ input: xml_path, ++ output: output_file, ++ ) ++ message('@0@ @1@: @2@ -> @3@'.format(prog_scanner, output_type, xml_path, output_file)) ++ endforeach ++ endforeach ++ endif ++ + # + # libspice-client-gtk.so + # +@@ -343,11 +401,11 @@ if spice_gtk_has_gtk + install : true, + link_args : [spice_gtk_version_script], + link_depends : spice_client_gtk_syms, +- dependencies : [spice_client_glib_dep, spice_gtk_deps]) ++ dependencies : [spice_client_glib_dep, spice_gtk_deps, spice_wayland_deps]) + + spice_client_gtk_dep = declare_dependency(sources : spice_widget_enums[1], + link_with : spice_client_gtk_lib, +- dependencies : [spice_client_glib_dep, spice_gtk_deps]) ++ dependencies : [spice_client_glib_dep, spice_gtk_deps, spice_wayland_deps]) + + if spice_gtk_has_introspection + # +-- +2.26.2 + diff --git a/SOURCES/0006-wayland-add-wayland-extensions-functions.patch b/SOURCES/0006-wayland-add-wayland-extensions-functions.patch new file mode 100644 index 0000000..b195ac2 --- /dev/null +++ b/SOURCES/0006-wayland-add-wayland-extensions-functions.patch @@ -0,0 +1,321 @@ +From 19e0922572cee7bda989a82407208eac8a41b47f Mon Sep 17 00:00:00 2001 +From: Francesco Giudici +Date: Tue, 28 Mar 2017 15:07:16 +0200 +Subject: [PATCH 6/9] wayland: add wayland-extensions functions + +add utilities to lock the pointer to a window and to get relative mouse +movement in Wayland. This is made possible thanks to the wayland +protocols introduced in the previous commit. + +Code freely taken and adapted from Christophe Fergeau branch: +https://gitlab.freedesktop.org/teuf/spice-gtk/-/tree/wayland + +Signed-off-by: Francesco Giudici +Acked-by: Frediano Ziglio +(cherry picked from commit 59d5c92c74da0f452b9104191bb752c33d26ec77) +--- + src/meson.build | 5 + + src/wayland-extensions.c | 235 +++++++++++++++++++++++++++++++++++++++ + src/wayland-extensions.h | 32 ++++++ + 3 files changed, 272 insertions(+) + create mode 100644 src/wayland-extensions.c + create mode 100644 src/wayland-extensions.h + +diff --git a/src/meson.build b/src/meson.build +index bdd2239..16810a7 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -374,6 +374,11 @@ if spice_gtk_has_gtk + message('@0@ @1@: @2@ -> @3@'.format(prog_scanner, output_type, xml_path, output_file)) + endforeach + endforeach ++ ++ spice_client_gtk_sources += [ ++ 'wayland-extensions.c', ++ 'wayland-extensions.h', ++ ] + endif + + # +diff --git a/src/wayland-extensions.c b/src/wayland-extensions.c +new file mode 100644 +index 0000000..64b5139 +--- /dev/null ++++ b/src/wayland-extensions.c +@@ -0,0 +1,235 @@ ++/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ ++/* ++ Copyright (C) 2017 Red Hat, Inc. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see . ++*/ ++ ++#include ++ ++#include ++#include ++ ++#include ++ ++#include ++#include "pointer-constraints-unstable-v1-client-protocol.h" ++#include "relative-pointer-unstable-v1-client-protocol.h" ++ ++#include "wayland-extensions.h" ++ ++static void * ++gtk_wl_registry_bind(GtkWidget *widget, ++ uint32_t name, ++ const struct wl_interface *interface, ++ uint32_t version) ++{ ++ GdkDisplay *gdk_display = gtk_widget_get_display(widget); ++ struct wl_display *display; ++ struct wl_registry *registry; ++ ++ if (!GDK_IS_WAYLAND_DISPLAY(gdk_display)) { ++ return NULL; ++ } ++ ++ display = gdk_wayland_display_get_wl_display(gdk_display); ++ registry = wl_display_get_registry(display); ++ ++ return wl_registry_bind(registry, name, interface, version); ++} ++ ++static void ++gtk_wl_registry_add_listener(GtkWidget *widget, const struct wl_registry_listener *listener) ++{ ++ GdkDisplay *gdk_display = gtk_widget_get_display(widget); ++ struct wl_display *display; ++ struct wl_registry *registry; ++ ++ if (!GDK_IS_WAYLAND_DISPLAY(gdk_display)) { ++ return; ++ } ++ ++ display = gdk_wayland_display_get_wl_display(gdk_display); ++ registry = wl_display_get_registry(display); ++ wl_registry_add_listener(registry, listener, widget); ++ wl_display_roundtrip(display); ++} ++ ++ ++static void ++registry_handle_global(void *data, ++ struct wl_registry *registry, ++ uint32_t name, ++ const char *interface, ++ uint32_t version) ++{ ++ GtkWidget *widget = GTK_WIDGET(data); ++ ++ if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) { ++ struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; ++ relative_pointer_manager = gtk_wl_registry_bind(widget, name, ++ &zwp_relative_pointer_manager_v1_interface, ++ 1); ++ g_object_set_data_full(G_OBJECT(widget), ++ "zwp_relative_pointer_manager_v1", ++ relative_pointer_manager, ++ (GDestroyNotify)zwp_relative_pointer_manager_v1_destroy); ++ } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { ++ struct zwp_pointer_constraints_v1 *pointer_constraints; ++ pointer_constraints = gtk_wl_registry_bind(widget, name, ++ &zwp_pointer_constraints_v1_interface, ++ 1); ++ g_object_set_data_full(G_OBJECT(widget), ++ "zwp_pointer_constraints_v1", ++ pointer_constraints, ++ (GDestroyNotify)zwp_pointer_constraints_v1_destroy); ++ } ++} ++ ++static void ++registry_handle_global_remove(void *data, ++ struct wl_registry *registry, ++ uint32_t name) ++{ ++} ++ ++static const struct wl_registry_listener registry_listener = { ++ registry_handle_global, ++ registry_handle_global_remove ++}; ++ ++void ++spice_wayland_extensions_init(GtkWidget *widget) ++{ ++ g_return_if_fail(GTK_IS_WIDGET(widget)); ++ ++ gtk_wl_registry_add_listener(widget, ®istry_listener); ++} ++ ++ ++static GdkDevice * ++spice_gdk_window_get_pointing_device(GdkWindow *window) ++{ ++ GdkDisplay *gdk_display = gdk_window_get_display(window); ++ ++ return gdk_seat_get_pointer(gdk_display_get_default_seat(gdk_display)); ++} ++ ++static struct zwp_relative_pointer_v1_listener relative_pointer_listener; ++ ++// NOTE this API works only on a single widget per application ++int ++spice_wayland_extensions_enable_relative_pointer(GtkWidget *widget, ++ void (*cb)(void *, ++ struct zwp_relative_pointer_v1 *, ++ uint32_t, uint32_t, ++ wl_fixed_t, wl_fixed_t, wl_fixed_t, wl_fixed_t)) ++{ ++ struct zwp_relative_pointer_v1 *relative_pointer; ++ ++ g_return_val_if_fail(GTK_IS_WIDGET(widget), -1); ++ ++ relative_pointer = g_object_get_data(G_OBJECT(widget), "zwp_relative_pointer_v1"); ++ ++ if (relative_pointer == NULL) { ++ struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; ++ GdkWindow *window = gtk_widget_get_window(widget); ++ struct wl_pointer *pointer; ++ ++ relative_pointer_manager = g_object_get_data(G_OBJECT(widget), "zwp_relative_pointer_manager_v1"); ++ if (relative_pointer_manager == NULL) ++ return -1; ++ ++ pointer = gdk_wayland_device_get_wl_pointer(spice_gdk_window_get_pointing_device(window)); ++ relative_pointer = zwp_relative_pointer_manager_v1_get_relative_pointer(relative_pointer_manager, ++ pointer); ++ ++ relative_pointer_listener.relative_motion = cb; ++ zwp_relative_pointer_v1_add_listener(relative_pointer, ++ &relative_pointer_listener, ++ widget); ++ ++ g_object_set_data_full(G_OBJECT(widget), ++ "zwp_relative_pointer_v1", ++ relative_pointer, ++ (GDestroyNotify)zwp_relative_pointer_v1_destroy); ++ } ++ ++ return 0; ++} ++ ++int spice_wayland_extensions_disable_relative_pointer(GtkWidget *widget) ++{ ++ g_return_val_if_fail(GTK_IS_WIDGET(widget), -1); ++ ++ /* This will call zwp_relative_pointer_v1_destroy() and stop relative ++ * movement */ ++ g_object_set_data(G_OBJECT(widget), "zwp_relative_pointer_v1", NULL); ++ ++ return 0; ++} ++ ++static struct zwp_locked_pointer_v1_listener locked_pointer_listener; ++ ++// NOTE this API works only on a single widget per application ++int ++spice_wayland_extensions_lock_pointer(GtkWidget *widget, ++ void (*lock_cb)(void *, struct zwp_locked_pointer_v1 *), ++ void (*unlock_cb)(void *, struct zwp_locked_pointer_v1 *)) ++{ ++ struct zwp_pointer_constraints_v1 *pointer_constraints; ++ struct zwp_locked_pointer_v1 *locked_pointer; ++ GdkWindow *window; ++ struct wl_pointer *pointer; ++ ++ g_return_val_if_fail(GTK_IS_WIDGET(widget), -1); ++ ++ pointer_constraints = g_object_get_data(G_OBJECT(widget), "zwp_pointer_constraints_v1"); ++ locked_pointer = g_object_get_data(G_OBJECT(widget), "zwp_locked_pointer_v1"); ++ if (locked_pointer != NULL) { ++ /* A previous lock already in place */ ++ return 0; ++ } ++ ++ window = gtk_widget_get_window(widget); ++ pointer = gdk_wayland_device_get_wl_pointer(spice_gdk_window_get_pointing_device(window)); ++ locked_pointer = zwp_pointer_constraints_v1_lock_pointer(pointer_constraints, ++ gdk_wayland_window_get_wl_surface(window), ++ pointer, ++ NULL, ++ ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT); ++ if (lock_cb || unlock_cb) { ++ locked_pointer_listener.locked = lock_cb; ++ locked_pointer_listener.unlocked = unlock_cb; ++ zwp_locked_pointer_v1_add_listener(locked_pointer, ++ &locked_pointer_listener, ++ widget); ++ } ++ g_object_set_data_full(G_OBJECT(widget), ++ "zwp_locked_pointer_v1", ++ locked_pointer, ++ (GDestroyNotify)zwp_locked_pointer_v1_destroy); ++ ++ return 0; ++} ++ ++int ++spice_wayland_extensions_unlock_pointer(GtkWidget *widget) ++{ ++ g_return_val_if_fail(GTK_IS_WIDGET(widget), -1); ++ ++ g_object_set_data(G_OBJECT(widget), "zwp_locked_pointer_v1", NULL); ++ ++ return 0; ++} +diff --git a/src/wayland-extensions.h b/src/wayland-extensions.h +new file mode 100644 +index 0000000..bf34044 +--- /dev/null ++++ b/src/wayland-extensions.h +@@ -0,0 +1,32 @@ ++/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ ++/* ++ Copyright (C) 2017 Red Hat, Inc. ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, see . ++*/ ++#pragma once ++ ++#include ++ ++void spice_wayland_extensions_init(GtkWidget *widget); ++int spice_wayland_extensions_enable_relative_pointer(GtkWidget *widget, ++ void (*cb)(void *, ++ struct zwp_relative_pointer_v1 *, ++ uint32_t, uint32_t, ++ wl_fixed_t, wl_fixed_t, wl_fixed_t, wl_fixed_t)); ++int spice_wayland_extensions_disable_relative_pointer(GtkWidget *widget); ++int spice_wayland_extensions_lock_pointer(GtkWidget *widget, ++ void (*lock_cb)(void *, struct zwp_locked_pointer_v1 *), ++ void (*unlock_cb)(void *, struct zwp_locked_pointer_v1 *)); ++int spice_wayland_extensions_unlock_pointer(GtkWidget *widget); +-- +2.26.2 + diff --git a/SOURCES/0007-spice-gtk-save-mouse-button-state-on-mouse-click.patch b/SOURCES/0007-spice-gtk-save-mouse-button-state-on-mouse-click.patch new file mode 100644 index 0000000..e3618ab --- /dev/null +++ b/SOURCES/0007-spice-gtk-save-mouse-button-state-on-mouse-click.patch @@ -0,0 +1,77 @@ +From 7e0f7bda8d5817c0cbfc56be4cf3727b98f223f4 Mon Sep 17 00:00:00 2001 +From: Francesco Giudici +Date: Mon, 20 Apr 2020 14:37:57 +0200 +Subject: [PATCH 7/9] spice-gtk: save mouse button state on mouse click + +This will be used later to couple it with relative mouse movement under +Wayland: we just get the mouse movement from the Wayland protocols +callback. + +Signed-off-by: Francesco Giudici +Acked-by: Frediano Ziglio +(cherry picked from commit 0fe70950524c28d383f34876c66107117581c72f) +--- + src/spice-widget-priv.h | 1 + + src/spice-widget.c | 22 +++++++++++++++++++++- + 2 files changed, 22 insertions(+), 1 deletion(-) + +diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h +index 436c802..0b282f5 100644 +--- a/src/spice-widget-priv.h ++++ b/src/spice-widget-priv.h +@@ -96,6 +96,7 @@ struct _SpiceDisplayPrivate { + SpiceSmartcardChannel *smartcard; + + enum SpiceMouseMode mouse_mode; ++ int mouse_button_mask; + int mouse_grab_active; + bool mouse_have_pointer; + GdkCursor *mouse_cursor; +diff --git a/src/spice-widget.c b/src/spice-widget.c +index 8b91f52..7700f47 100644 +--- a/src/spice-widget.c ++++ b/src/spice-widget.c +@@ -1954,7 +1954,21 @@ static int button_gdk_to_spice(guint gdk) + }; + + if (gdk < SPICE_N_ELEMENTS(map)) { +- return map [ gdk ]; ++ return map[gdk]; ++ } ++ return 0; ++} ++ ++static int button_gdk_to_spice_mask(guint gdk) ++{ ++ static const int map[] = { ++ [1] = SPICE_MOUSE_BUTTON_MASK_LEFT, ++ [2] = SPICE_MOUSE_BUTTON_MASK_MIDDLE, ++ [3] = SPICE_MOUSE_BUTTON_MASK_RIGHT, ++ }; ++ ++ if (gdk < SPICE_N_ELEMENTS(map)) { ++ return map[gdk]; + } + return 0; + } +@@ -2160,11 +2174,17 @@ static gboolean button_event(GtkWidget *widget, GdkEventButton *button) + spice_inputs_channel_button_press(d->inputs, + button_gdk_to_spice(button->button), + button_mask_gdk_to_spice(button->state)); ++ /* Save the mouse button mask to couple it with Wayland movement */ ++ d->mouse_button_mask = button_mask_gdk_to_spice(button->state); ++ d->mouse_button_mask |= button_gdk_to_spice_mask(button->button); + break; + case GDK_BUTTON_RELEASE: + spice_inputs_channel_button_release(d->inputs, + button_gdk_to_spice(button->button), + button_mask_gdk_to_spice(button->state)); ++ /* Save the mouse button mask to couple it with Wayland movement */ ++ d->mouse_button_mask = button_mask_gdk_to_spice(button->state); ++ d->mouse_button_mask ^= button_gdk_to_spice_mask(button->button); + break; + default: + break; +-- +2.26.2 + diff --git a/SOURCES/0008-wayland-fix-mouse-lock-in-server-mode.patch b/SOURCES/0008-wayland-fix-mouse-lock-in-server-mode.patch new file mode 100644 index 0000000..5c5253e --- /dev/null +++ b/SOURCES/0008-wayland-fix-mouse-lock-in-server-mode.patch @@ -0,0 +1,181 @@ +From 16cdb3a8cdd60da9eef12d1d10a01d4eed21a5a7 Mon Sep 17 00:00:00 2001 +From: Francesco Giudici +Date: Mon, 20 Apr 2020 10:25:03 +0200 +Subject: [PATCH 8/9] wayland: fix mouse lock in server mode + +We can now properly manage mouse pointer lock by using the wayland protocols. +Includes fix from Frediano Ziglio to manage switching from mouse in +server mode to client mode without releasing the pointer +(see https://gitlab.freedesktop.org/fziglio/spice-gtk/-/commit/c14b047e45) + +Signed-off-by: Francesco Giudici +Acked-by: Frediano Ziglio +(cherry picked from commit dd7015d57ca936cc81060b1e2a09d3afc1478d4a) +--- + src/spice-widget.c | 85 +++++++++++++++++++++++++++++++++++----------- + 1 file changed, 66 insertions(+), 19 deletions(-) + +diff --git a/src/spice-widget.c b/src/spice-widget.c +index 7700f47..6cfc72f 100644 +--- a/src/spice-widget.c ++++ b/src/spice-widget.c +@@ -34,7 +34,13 @@ + #endif + #ifdef GDK_WINDOWING_WAYLAND + #include ++#ifdef HAVE_WAYLAND_PROTOCOLS ++#include "pointer-constraints-unstable-v1-client-protocol.h" ++#include "relative-pointer-unstable-v1-client-protocol.h" ++#include "wayland-extensions.h" + #endif ++#endif ++ + #ifdef G_OS_WIN32 + #include + #include +@@ -698,6 +704,11 @@ static void spice_display_init(SpiceDisplay *display) + + d->grabseq = spice_grab_sequence_new_from_string("Control_L+Alt_L"); + d->activeseq = g_new0(gboolean, d->grabseq->nkeysyms); ++ ++#ifdef HAVE_WAYLAND_PROTOCOLS ++ if GDK_IS_WAYLAND_DISPLAY(gtk_widget_get_display(widget)) ++ spice_wayland_extensions_init(widget); ++#endif + } + + static void +@@ -900,7 +911,7 @@ static void ungrab_keyboard(SpiceDisplay *display) + * We simply issue a gdk_seat_ungrab() followed immediately by another + * gdk_seat_grab() on the pointer if the pointer grab is to be kept. + */ +- if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { ++ if (GDK_IS_WAYLAND_DISPLAY(gtk_widget_get_display(GTK_WIDGET(display)))) { + SpiceDisplayPrivate *d = display->priv; + + gdk_seat_ungrab(seat); +@@ -1055,15 +1066,49 @@ error: + } + #endif + ++#ifdef HAVE_WAYLAND_PROTOCOLS ++static void ++relative_pointer_handle_relative_motion(void *data, ++ struct zwp_relative_pointer_v1 *pointer, ++ uint32_t time_hi, ++ uint32_t time_lo, ++ wl_fixed_t dx_w, ++ wl_fixed_t dy_w, ++ wl_fixed_t dx_unaccel_w, ++ wl_fixed_t dy_unaccel_w) ++{ ++ SpiceDisplay *display = SPICE_DISPLAY(data); ++ GtkWidget *widget = GTK_WIDGET(display); ++ SpiceDisplayPrivate *d = display->priv; ++ ++ if (!d->inputs) ++ return; ++ if (d->disable_inputs) ++ return; ++ /* mode changed to client in the meantime */ ++ if (d->mouse_mode != SPICE_MOUSE_MODE_SERVER) { ++ spice_wayland_extensions_disable_relative_pointer(widget); ++ spice_wayland_extensions_unlock_pointer(widget); ++ return; ++ } ++ ++ spice_inputs_channel_motion(d->inputs, ++ wl_fixed_to_int(dx_unaccel_w), ++ wl_fixed_to_int(dy_unaccel_w), ++ d->mouse_button_mask); ++} ++#endif ++ + static gboolean do_pointer_grab(SpiceDisplay *display) + { ++ GtkWidget *widget = GTK_WIDGET(display); + SpiceDisplayPrivate *d = display->priv; +- GdkWindow *window = GDK_WINDOW(gtk_widget_get_window(GTK_WIDGET(display))); ++ GdkWindow *window = GDK_WINDOW(gtk_widget_get_window(widget)); + GdkGrabStatus status; + GdkCursor *blank = spice_display_get_blank_cursor(display); + gboolean grab_successful = FALSE; + +- if (!gtk_widget_get_realized(GTK_WIDGET(display))) ++ if (!gtk_widget_get_realized(widget)) + goto end; + + #ifdef G_OS_WIN32 +@@ -1080,6 +1125,14 @@ static gboolean do_pointer_grab(SpiceDisplay *display) + NULL, + NULL, + NULL); ++ ++#ifdef HAVE_WAYLAND_PROTOCOLS ++ if (GDK_IS_WAYLAND_DISPLAY(gtk_widget_get_display(widget))) { ++ spice_wayland_extensions_enable_relative_pointer(widget, relative_pointer_handle_relative_motion); ++ spice_wayland_extensions_lock_pointer(widget, NULL, NULL); ++ } ++#endif ++ + grab_successful = (status == GDK_GRAB_SUCCESS); + if (!grab_successful) { + d->mouse_grab_active = false; +@@ -1204,7 +1257,8 @@ static void ungrab_pointer(SpiceDisplay *display) + * immediately by another gdk_seat_grab() on the keyboard if the + * keyboard grab is to be kept. + */ +- if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { ++ if (GDK_IS_WAYLAND_DISPLAY(gtk_widget_get_display(GTK_WIDGET(display)))) { ++ GtkWidget *widget = GTK_WIDGET(display); + SpiceDisplayPrivate *d = display->priv; + + gdk_seat_ungrab(seat); +@@ -1213,7 +1267,7 @@ static void ungrab_pointer(SpiceDisplay *display) + GdkGrabStatus status; + + status = gdk_seat_grab(seat, +- gtk_widget_get_window(GTK_WIDGET(display)), ++ gtk_widget_get_window(widget), + GDK_SEAT_CAPABILITY_KEYBOARD, + FALSE, + NULL, +@@ -1224,6 +1278,12 @@ static void ungrab_pointer(SpiceDisplay *display) + g_warning("keyboard grab failed %u", status); + d->keyboard_grab_active = false; + } ++#ifdef HAVE_WAYLAND_PROTOCOLS ++ if (d->mouse_mode == SPICE_MOUSE_MODE_SERVER) { ++ spice_wayland_extensions_disable_relative_pointer(widget); ++ spice_wayland_extensions_unlock_pointer(widget); ++ } ++#endif + } + + return; +@@ -1860,21 +1920,8 @@ static gboolean leave_event(GtkWidget *widget, GdkEventCrossing *crossing G_GNUC + + DISPLAY_DEBUG(display, "%s", __FUNCTION__); + +- if (d->mouse_grab_active) { +-#ifdef GDK_WINDOWING_WAYLAND +- /* On Wayland, there is no active pointer grab, so once the pointer +- * has left the window, the events are routed to the window with +- * pointer focus instead of ours, in which case we should just +- * ungrab to avoid nasty side effects. */ +- if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { +- GdkWindow *window = gtk_widget_get_window(widget); +- +- if (window == crossing->window) +- try_mouse_ungrab(display); +- } +-#endif ++ if (d->mouse_grab_active) + return true; +- } + + d->mouse_have_pointer = false; + spice_gtk_session_set_mouse_has_pointer(d->gtk_session, false); +-- +2.26.2 + diff --git a/SOURCES/0009-channel-main-Handle-some-detailed-error-for-VD_AGENT.patch b/SOURCES/0009-channel-main-Handle-some-detailed-error-for-VD_AGENT.patch new file mode 100644 index 0000000..9f1255c --- /dev/null +++ b/SOURCES/0009-channel-main-Handle-some-detailed-error-for-VD_AGENT.patch @@ -0,0 +1,54 @@ +From 769465494c5e3e4299a2dfdf6e0c835be4e04ab7 Mon Sep 17 00:00:00 2001 +From: Frediano Ziglio +Date: Thu, 19 Mar 2020 06:12:34 +0000 +Subject: [PATCH 9/9] channel-main: Handle some detailed error for + VD_AGENT_FILE_XFER_STATUS_ERROR + +Detect presence of detail on VD_AGENT_FILE_XFER_STATUS_ERROR and +if the error is supported give more detailed information, otherwise +fallback to the old generic error. + +Signed-off-by: Frediano Ziglio +Acked-by: Victor Toso +(cherry picked from commit d79b05dcff83792c8415cafbb288d614de9d3101) +--- + src/channel-main.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/src/channel-main.c b/src/channel-main.c +index c4fe02b..d845fda 100644 +--- a/src/channel-main.c ++++ b/src/channel-main.c +@@ -1913,10 +1913,26 @@ static void main_agent_handle_xfer_status(SpiceMainChannel *channel, + error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, + _("The spice agent cancelled the file transfer")); + break; +- case VD_AGENT_FILE_XFER_STATUS_ERROR: +- error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, +- _("The spice agent reported an error during the file transfer")); ++ case VD_AGENT_FILE_XFER_STATUS_ERROR: { ++ const VDAgentFileXferStatusError *err = (VDAgentFileXferStatusError *) msg->data; ++ if (test_agent_cap(channel, VD_AGENT_CAP_FILE_XFER_DETAILED_ERRORS) && ++ msg_hdr->size >= sizeof(*msg) + sizeof(*err) && ++ err->error_type == VD_AGENT_FILE_XFER_STATUS_ERROR_GLIB_IO) { ++ ++ switch (err->error_code) { ++ case G_IO_ERROR_INVALID_FILENAME: ++ error = g_error_new_literal(G_IO_ERROR, err->error_code, ++ _("Invalid filename of transferred file")); ++ break; ++ } ++ } ++ if (error == NULL) { ++ error = g_error_new_literal(SPICE_CLIENT_ERROR, SPICE_CLIENT_ERROR_FAILED, ++ _("The spice agent reported an error " ++ "during the file transfer")); ++ } + break; ++ } + case VD_AGENT_FILE_XFER_STATUS_NOT_ENOUGH_SPACE: { + const VDAgentFileXferStatusNotEnoughSpace *err = + (VDAgentFileXferStatusNotEnoughSpace*) msg->data; +-- +2.26.2 + diff --git a/SOURCES/spice-gtk-0.38.tar.xz.sig b/SOURCES/spice-gtk-0.38.tar.xz.sig new file mode 100644 index 0000000..eab14d2 Binary files /dev/null and b/SOURCES/spice-gtk-0.38.tar.xz.sig differ diff --git a/SPECS/spice-gtk.spec b/SPECS/spice-gtk.spec new file mode 100644 index 0000000..b033482 --- /dev/null +++ b/SPECS/spice-gtk.spec @@ -0,0 +1,542 @@ +#define _version_suffix + +Name: spice-gtk +Version: 0.38 +Release: 2%{?dist} +Summary: A GTK+ widget for SPICE clients + +Group: System Environment/Libraries +License: LGPLv2+ +URL: http://spice-space.org/page/Spice-Gtk +#VCS: git:git://anongit.freedesktop.org/spice/spice-gtk +Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz +Source1: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz.sig +Source2: victortoso-E37A484F.keyring +Patch0001: 0001-channel-main-Avoid-macro-side-effects.patch +Patch0002: 0002-channel-main-Check-proper-size-and-caps-handling-VD_.patch +Patch0003: 0003-build-sys-bump-polkit-requirement-to-0.101.patch +Patch0004: 0004-spice-channel-Read-all-available-data-from-SASL-buff.patch +Patch0005: 0005-meson-add-wayland-protocols.patch +Patch0006: 0006-wayland-add-wayland-extensions-functions.patch +Patch0007: 0007-spice-gtk-save-mouse-button-state-on-mouse-click.patch +Patch0008: 0008-wayland-fix-mouse-lock-in-server-mode.patch +Patch0009: 0009-channel-main-Handle-some-detailed-error-for-VD_AGENT.patch + +BuildRequires: meson +BuildRequires: git-core +BuildRequires: gnupg2 +BuildRequires: intltool +BuildRequires: usbredir-devel >= 0.7.1 +BuildRequires: libusb1-devel >= 1.0.21 +BuildRequires: libgudev1-devel +BuildRequires: pixman-devel libjpeg-turbo-devel +BuildRequires: celt051-devel pulseaudio-libs-devel opus-devel +BuildRequires: zlib-devel +BuildRequires: cyrus-sasl-devel +BuildRequires: libcacard-devel +BuildRequires: gobject-introspection-devel +BuildRequires: libacl-devel +BuildRequires: polkit-devel +BuildRequires: gtk-doc +BuildRequires: vala-tools +BuildRequires: usbutils +BuildRequires: libsoup-devel >= 2.49.91 +BuildRequires: lz4-devel +BuildRequires: gtk3-devel +BuildRequires: json-glib-devel +BuildRequires: spice-protocol >= 0.14.2 +BuildRequires: gstreamer1-devel >= 1.10.0 gstreamer1-plugins-base-devel >= 1.10.0 +BuildRequires: python3-devel python3-six python3-pyparsing +BuildRequires: wayland-protocols-devel >= 1.17 +BuildRequires: libwayland-server libwayland-cursor libwayland-client +Obsoletes: spice-gtk-python < 0.32 + +Requires: spice-glib%{?_isa} = %{version}-%{release} + +BuildRequires: openssl-devel + +%description +Client libraries for SPICE desktop servers. + +%package -n spice-glib +Summary: A GObject for communicating with Spice servers +Group: Development/Libraries + +%description -n spice-glib +spice-client-glib-2.0 is a SPICE client library for GLib2. + +%package -n spice-glib-devel +Summary: Development files to build Glib2 applications with spice-glib-2.0 +Group: Development/Libraries +Requires: spice-glib%{?_isa} = %{version}-%{release} +Requires: pkgconfig +Requires: glib2-devel + +%description -n spice-glib-devel +spice-client-glib-2.0 is a SPICE client library for GLib2. + +Libraries, includes, etc. to compile with the spice-glib-2.0 libraries + +%package -n spice-gtk3 +Summary: A GTK3 widget for SPICE clients +Group: Development/Libraries +Requires: spice-glib%{?_isa} = %{version}-%{release} + +%description -n spice-gtk3 +spice-client-glib-3.0 is a SPICE client library for Gtk3. + +%package -n spice-gtk3-devel +Summary: Development files to build GTK3 applications with spice-gtk-3.0 +Group: Development/Libraries +Requires: spice-gtk3%{?_isa} = %{version}-%{release} +Requires: spice-glib-devel%{?_isa} = %{version}-%{release} +Requires: pkgconfig +Requires: gtk3-devel +Obsoletes: spice-gtk-devel < 0.32 + +%description -n spice-gtk3-devel +spice-client-gtk-3.0 provides a SPICE viewer widget for GTK3. + +Libraries, includes, etc. to compile with the spice-gtk3 libraries + +%package -n spice-gtk3-vala +Summary: Vala bindings for the spice-gtk-3.0 library +Group: Development/Libraries +Requires: spice-gtk3%{?_isa} = %{version}-%{release} +Requires: spice-gtk3-devel%{?_isa} = %{version}-%{release} + +%description -n spice-gtk3-vala +A module allowing use of the spice-gtk-3.0 widget from vala + +%package tools +Summary: Spice-gtk tools +Group: Applications/Internet +Requires: spice-gtk3%{?_isa} = %{version}-%{release} +Requires: spice-glib%{?_isa} = %{version}-%{release} + +%description tools +Simple clients for interacting with SPICE servers. +spicy is a client to a SPICE desktop server. +spicy-screenshot is a tool to capture screen-shots of a SPICE desktop. + + +%prep +gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} +%autosetup -S git_am + +%build +%meson \ + -Dgtk_doc=enabled \ + -Dusb-acl-helper-dir=%{_libexecdir}/spice-gtk-%{_arch}/ \ + -Dlz4=enabled \ + -Dvapi=enabled \ + -Dcelt051=disabled \ + -Dwayland-protocols=enabled \ + -Dwebdav=disabled + +%meson_build + +%install +%meson_install + +%find_lang %{name} + +%ldconfig_scriptlets +%ldconfig_scriptlets -n spice-glib +%ldconfig_scriptlets -n spice-gtk3 + + +%files +%doc AUTHORS +%doc COPYING +%doc README.md +%doc CHANGELOG.md +%{_mandir}/man1/spice-client.1* + +%files -n spice-glib -f %{name}.lang +%{_libdir}/libspice-client-glib-2.0.so.* +%{_libdir}/girepository-1.0/SpiceClientGLib-2.0.typelib +%dir %{_libexecdir}/spice-gtk-%{_arch}/ +%attr(4755, root, root) %{_libexecdir}/spice-gtk-%{_arch}/spice-client-glib-usb-acl-helper +%{_datadir}/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy + +%files -n spice-glib-devel +%{_libdir}/libspice-client-glib-2.0.so +%{_includedir}/spice-client-glib-2.0 +%{_libdir}/pkgconfig/spice-client-glib-2.0.pc +%{_datadir}/gir-1.0/SpiceClientGLib-2.0.gir +%doc %{_datadir}/gtk-doc/html/* + +%files -n spice-gtk3 +%{_libdir}/libspice-client-gtk-3.0.so.* +%{_libdir}/girepository-1.0/SpiceClientGtk-3.0.typelib + +%files -n spice-gtk3-devel +%{_libdir}/libspice-client-gtk-3.0.so +%{_includedir}/spice-client-gtk-3.0 +%{_libdir}/pkgconfig/spice-client-gtk-3.0.pc +%{_datadir}/gir-1.0/SpiceClientGtk-3.0.gir + +%files -n spice-gtk3-vala +%{_datadir}/vala/vapi/spice-client-glib-2.0.deps +%{_datadir}/vala/vapi/spice-client-glib-2.0.vapi +%{_datadir}/vala/vapi/spice-client-gtk-3.0.deps +%{_datadir}/vala/vapi/spice-client-gtk-3.0.vapi + +%files tools +%{_bindir}/spicy +%{_bindir}/spicy-screenshot +%{_bindir}/spicy-stats + +%changelog +* Tue May 20 2020 Victor Toso - 0.38-2 +- Brings some post releases fixes and disables celt051 that is + deprecated in spice-protocol 0.14.2 +- Possibly related to rhbz#1688737 rhbz#1746239 + Related: rhbz#1817471 +- Fix mouse pointer on relative mouse mode + Resolves: rhbz#1674311 +- Handle detailed errors from guest agent + Related: rhbz#1520393 + +* Tue May 05 2020 Victor Toso - 0.38-1 +- Update to 0.38 + Resolves: rhbz#1817471 + +* Fri May 17 2019 Victor Toso - 0.37-1 +- Update to 0.37 + Resolves: rhbz#1711370 +- Use gpg to check that tarball matches upstream release + +* Fri Oct 12 2018 Frediano Ziglio - 0.35-7 +- Check for overflows decoding LZ4 + Resolves: rhbz#1598242 + +* Wed Oct 10 2018 Frediano Ziglio - 0.35-6 +- Fix insufficient encoding checks for LZ + Resolves: rhbz#1598234 + +* Wed Aug 15 2018 Victor Toso - 0.35-4 +- Disable shared folders downstream (phodav) +- Resolves: rhbz#1615985 + +* Mon Aug 13 2018 Victor Toso - 0.35-3 +- Include python3-devel to not fail on rhel-8.0 builds +- Resolves: rhbz#1615571 + +* Mon Jul 30 2018 Florian Weimer - 0.35-2 +- Rebuild with fixed binutils + +* Mon Jul 30 2018 Victor Toso - 0.35-1 +- Update to 0.35 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.34-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sat Feb 03 2018 Igor Gnatenko - 0.34-3 +- Switch to %%ldconfig_scriptlets + +* Thu Aug 24 2017 Christophe Fergeau - 0.34-2 +- Build against OpenSSL 1.1.0 rather than the older 1.0 + +* Mon Jul 31 2017 Marc-André Lureau - 0.34-1 +- v0.34 release + +* Thu Jul 27 2017 Fedora Release Engineering - 0.33-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Tue Jun 20 2017 Cole Robinson - 0.33-5 +- channel-usbredir: Fix crash on channel-up. Resolves: rhbz#1399838 +- usbutils no longer ships usb.ids, it is hwdata now, set path manually. +- Backport fixes for "Couldn't find current GL or GLX context" Resolves: rhbz#1461802 + +* Sat Feb 11 2017 Fedora Release Engineering - 0.33-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Tue Oct 25 2016 Victor Toso - 0.33-2 +- Fix crash due clipboard failure with text conversion + Resolves: rhbz#1384676 + +* Fri Oct 07 2016 Marc-André Lureau - 0.33-1 +- Update to new 0.33 upstream release + +* Thu Oct 06 2016 Marc-André Lureau - 0.32-3 +- Fix display refresh unless scaling is forced (rhbz#1382325) + +* Mon Jul 11 2016 Christophe Fergeau 0.32-2 +- Add upstream patches fixing USB event thread leak + Resolves: rhbz#1217202 (virt-manager) + May help with rhbz#1338042 (gnome-boxes) + +* Tue Jun 21 2016 Marc-André Lureau 0.32-1 +- Update to new 0.32 upstream release + +* Fri Apr 15 2016 Christophe Fergeau - 0.31-2 +- Add upstream patch fixing flickering bug + Resolves: rhbz#1266484 + +* Fri Mar 11 2016 Marc-André Lureau 0.31-1 +- Update to new 0.31 upstream release + +* Fri Feb 05 2016 Fedora Release Engineering - 0.30-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Oct 06 2015 Christophe Fergeau 0.30-1 +- Update to new 0.30 upstream release + +* Sat Sep 12 2015 Cole Robinson 0.29-4 +- Fix virt-manager default screen resolution and resolution across reboots +- Resolves: rhbz#1240721 + +* Tue Sep 08 2015 Christophe Fergeau 0.29-3 +- Don't crash on volume sync when there is no audio channel + Resolves: rhbz#1257210 + +* Fri Jun 19 2015 Fedora Release Engineering - 0.29-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Mon Jun 15 2015 Marc-Andre Lureau 0.29-1 +- Update to spice-gtk v0.29 + +* Mon May 11 2015 Marc-Andre Lureau 0.28-3 +- Fix audio and usb channels with GNOME Boxes. + Resolves: rhbz#1220026 + +* Tue Mar 31 2015 Christophe Fergeau 0.28-2 +- Add upstream patch fixing an USB redirection crash + Resolves: rhbz#1182226 +- Adjust build requires to new naming of phodav package + +* Wed Mar 4 2015 Marc-André Lureau 0.28-1 +- Update to spice-gtk v0.28 + +* Mon Feb 23 2015 Christophe Fergeau 0.27-6 +- Rebuild for phodav soname bump + +* Tue Jan 27 2015 Marc-André Lureau 0.27-5 +- Fix reconnection on same session regressions introduced in 27-2. + +* Tue Dec 30 2014 Christophe Fergeau 0.27-4 +- Enable lz4 support + +* Mon Dec 22 2014 Marc-André Lureau 0.27-3 +- Fix usbredir crash on disconnection. + +* Tue Dec 16 2014 Marc-André Lureau 0.27-2 +- Fix authentication error handling regression. + +* Thu Dec 11 2014 Marc-André Lureau 0.27-1 +- Update to spice-gtk v0.27 + +* Wed Oct 29 2014 Christophe Fergeau 0.26-1 +- Update to spice-gtk v0.26 + +* Wed Sep 24 2014 Christophe Fergeau 0.25-6 +- Run make install in gtk3 build after doing so in gtk2 build, otherwise + we'll end up packaging gtk2 builds of spicy et al in spice-client-tools + instead of gtk3 ones (#1145829) + +* Wed Aug 20 2014 Kalev Lember - 0.25-5 +- Rebuilt for rpm dependency generator failure (#1131892) + +* Mon Aug 18 2014 Fedora Release Engineering - 0.25-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Tue Jul 22 2014 Kalev Lember - 0.25-3 +- Rebuilt for gobject-introspection 1.41.4 + +* Sun Jun 08 2014 Fedora Release Engineering - 0.25-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue Feb 25 2014 Marc-André Lureau - 0.25-1 +- Update to upstream release v0.25 +- Added phodav dependency + +* Tue Feb 25 2014 Marc-André Lureau - 0.23-2 +- Fix crash on finishing display rhbz#1069546 + +* Mon Feb 10 2014 Marc-André Lureau - 0.23-1 +- Update to spice-gtk 0.23 + +* Wed Nov 27 2013 Marc-André Lureau - 0.22-1 +- Update to spice-gtk 0.22 + +* Sun Nov 17 2013 Cole Robinson - 0.21-5 +- Fix grub graphical corruption after VM reboot (bz #1017955) + +* Mon Oct 21 2013 Alon Levy - 0.21-4 +- Fix mono invert only cursor contract. rhbz#998529 + +* Thu Oct 3 2013 Marc-André Lureau - 0.21-3 +- Fix palette cache regression. rhbz#1011936 + +* Mon Sep 30 2013 Marc-André Lureau - 0.21-2 +- Fix usbredir being broken in 0.21 release + +* Wed Sep 18 2013 Marc-André Lureau - 0.21-1 +- Update to spice-gtk 0.21 + +* Fri Sep 13 2013 Christophe Fergeau 0.20-6 +- Add misc upstream patches fixing various 0.20 bugs + +* Wed Aug 28 2013 Alon Levy - 0.20-5 +- Fix wrong mono cursor local rendering (rhbz#998529) + +* Wed Aug 28 2013 Hans de Goede - 0.20-4 +- Fix the spice-client-glib-usb-acl-helper no longer being suid root + +* Sun Aug 04 2013 Fedora Release Engineering - 0.20-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sat Jul 6 2013 Marc-André Lureau - 0.20-2 +- Fix spice_channel_string_to_type symbol visibility (rhbz#981815) + +* Wed Jun 26 2013 Marc-André Lureau - 0.20-1 +- Update to spice-gtk 0.20 + +* Thu Apr 11 2013 Marc-André Lureau - 0.19-1 +- Update to spice-gtk 0.19 + +* Thu Mar 14 2013 Hans de Goede - 0.18-2 +- Fix "Warning no automount-inhibiting implementation available" warnings + +* Wed Feb 13 2013 Marc-André Lureau - 0.18-1 +- Update to spice-gtk 0.18 + +* Wed Feb 6 2013 Marc-André Lureau - 0.17-1 +- Update to spice-gtk 0.17 + +* Thu Jan 31 2013 Marc-André Lureau - 0.16-2 +- Remove perl-text-csv build requirement. (rhbz#873174) + +* Sat Jan 12 2013 Marc-André Lureau - 0.16-1 +- Update to spice-gtk 0.16 + +* Mon Dec 31 2012 Marc-André Lureau - 0.15.3-1 +- Update to spice-gtk 0.15.3, fixes TLS & password regressions + +* Fri Dec 21 2012 Christophe Fergeau - 0.15-2 +- Update to spice-gtk 0.15 + +* Thu Oct 25 2012 Christophe Fergeau - 0.14-2 +- Add various upstream patches + +* Fri Sep 21 2012 Christophe Fergeau - 0.14-1 +- Update to 0.14 release + +* Fri Sep 14 2012 Christophe Fergeau - 0.13.29-4 +- Add patch fixing CVE 2012-4425 + +* Thu Sep 13 2012 Christophe Fergeau - 0.13.29-3 +- Run autoreconf after applying patch 2 as it only modifies Makefile.am + +* Tue Sep 11 2012 Christophe Fergeau - 0.13.29-2 +- Add patch to fix symbol versioning + +* Fri Sep 7 2012 Hans de Goede - 0.13.29-1 +- Update to the spice-gtk 0.13.29 development release +- Rebuild for new usbredir + +* Mon Sep 03 2012 Christophe Fergeau - 0.13-2 +- Update to spice-gtk 0.13 + +* Tue Aug 07 2012 Christophe Fergeau - 0.12.101-1 +- Update to the spice-gtk 0.12.101 development release (needed by Boxes + 3.5.5) + +* Sat Jul 21 2012 Fedora Release Engineering - 0.12-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue May 15 2012 Marc-André Lureau - 0.12-4 +- re-Add back spice-protocol BuildRequires to help some deps magic happen + +* Thu May 10 2012 Marc-André Lureau - 0.12-3 +- Fix Spice.Audio constructor Python binding + https://bugzilla.redhat.com/show_bug.cgi?id=820335 + +* Wed May 2 2012 Marc-André Lureau - 0.12-2 +- Fix virt-manager console not showing up, rhbz#818169 + +* Tue Apr 24 2012 Marc-André Lureau - 0.12-1 +- New upstream release 0.12 + +* Tue Apr 10 2012 Christophe Fergeau - 0.11-5 +- Fix build on PPC +- Remove ExclusiveArch. While spice-gtk will build on ARM and PPC, it + hasn't been tested on these arch, so there may be some bugs. + +* Tue Mar 20 2012 Hans de Goede - 0.11-4 +- Add missing BuildRequires: usbutils, so that we get proper USB device + descriptions in the USB device selection menu + +* Wed Mar 14 2012 Hans de Goede - 0.11-3 +- Fix a crash triggered when trying to view a usbredir enabled vm from + virt-manager + +* Mon Mar 12 2012 Hans de Goede - 0.11-2 +- Add back spice-protocol BuildRequires to help some deps magic happen + +* Fri Mar 9 2012 Hans de Goede - 0.11-1 +- New upstream release 0.11 +- Fix multilib conflict in spice-glib + +* Thu Feb 23 2012 Marc-André Lureau - 0.10-1 +- New upstream release 0.10 + +* Mon Jan 30 2012 Hans de Goede - 0.9-1 +- New upstream release 0.9 + +* Mon Jan 16 2012 Hans de Goede - 0.8-1 +- New upstream release 0.8 +- Various small specfile improvements +- Enable vala bindings + +* Sat Jan 14 2012 Fedora Release Engineering - 0.7.39-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Nov 14 2011 Adam Jackson 0.7.39-2 +- Rebuild to break bogus libpng dependency +- Fix summaries for gtk3 subpackages to not talk about gtk2 + +* Fri Sep 2 2011 Hans de Goede - 0.7.39-1 +- Update to git snapshot 0.7.39-ab64, to add usbredir support + +* Tue Jul 26 2011 Marc-André Lureau - 0.7.1-1 +- Upstream version 0.7.1-d5a8 (fix libtool versionning) + +* Tue Jul 19 2011 Marc-André Lureau - 0.7-1 +- Upstream release 0.7 + +* Wed May 25 2011 Christophe Fergeau - 0.6-1 +- Upstream release 0.6 + +* Tue Mar 1 2011 Hans de Goede - 0.5-6 +- Fix spice-glib requires in .pc file (#680314) + +* Fri Feb 11 2011 Matthias Clasen - 0.5-5 +- Fix build against glib 2.28 + +* Thu Feb 10 2011 Matthias Clasen - 0.5-4 +- Rebuild against newer gtk + +* Wed Feb 09 2011 Fedora Release Engineering - 0.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Feb 2 2011 Matthias Clasen - 0.5-2 +- Rebuild against newer gtk + +* Thu Jan 27 2011 Marc-André Lureau - 0.5-1 +- Upstream release 0.5 + +* Fri Jan 14 2011 Daniel P. Berrange - 0.4-2 +- Add support for parallel GTK3 build + +* Mon Jan 10 2011 Dan Horák - 0.4-2 +- add ExclusiveArch as only x86 is supported + +* Sun Jan 09 2011 Marc-André Lureau - 0.4-1 +- Upstream release 0.4 +- Initial release (#657403) + +* Thu Nov 25 2010 Marc-André Lureau - 0.1.0-1 +- Initial packaging