summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-06-27fix invalid use of subprojectsEli Schwartz3-4/+5
The keycodemapdb Meson subproject provides a program and a source input. Since it is a subproject, Meson wants to sandbox that and requires it to be explicitly exported. But this never happened -- instead, we manually poked at files using the actual string path "subprojects/......" This was always a Meson sandbox violation, but Meson 0.63.0 started noticing it and erroring out. Instead, do the right thing. Update the subproject to a version that has a meson.build with actually meaningful contents -- namely, a files variable and a found program. Then use these in order to run the needed custom_target. In the process, it is also necessary to correct the argument ordering when running keymap-gen. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-03-06meson: move cairo dependency to GTK build onlyosy1-2/+2
Cairo is only used in SpiceDisplay which is part of the GTK client. If we are building the GLib only client, it should be optional.
2022-03-04coroutine: add support for libucontextosy4-3/+20
libucontext is a lightweight implementation of ucontext for platforms that do not have a built-in implementation. This allows us to use the same code to support libucontext as ucontext.
2022-02-07Release v0.40v0.40Victor Toso2-4/+22
Signed-off-by: Victor Toso <victortoso@redhat.com>
2022-01-28Implemented the ability to allocate SpiceUsbDevice instancesIordan Iordanov7-9/+90
by passing an open file descriptor in order to support the modern Android USB device permissioning scheme. During the process, a handle obtained by a call to libusb_wrap_sys_device() is stored in the SpiceUsbDevice instance. A call to libusb_open() is skipped if there is already a handle present in the SpiceUsbDevice instance. Finally, on Android, the option LIBUSB_OPTION_NO_DEVICE_DISCOVERY must be set prior to the call to libusb_init() as per libusb documentation. Acked-by: Frediano Ziglio <freddy77@gmail.com>
2022-01-28channel-main: Remove unused codeFrediano Ziglio1-3/+0
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2022-01-28Update spice-common submoduleFrediano Ziglio1-0/+0
This brings in the following changes: Frediano Ziglio (2): build: Correctly check for Python modules ci: Set WINEPATH during Windows build This fixes https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/152. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2022-01-18Capture and forward side mouse buttons (BTN_SIDE and BTN_EXTRA)Kevin Pouget2-0/+24
Adds support for capturing and forwarding the side mouse buttons some mouses have, typically used in web browsers for previous/next website in history. (Those are presented by GDK as buttons 8 and 9.) spice-vdagent requires a corresponding patch to handle the buttons. At the spice and protocol level, the required changes were previously merged: * https://gitlab.freedesktop.org/spice/spice/-/issues/45 * https://gitlab.freedesktop.org/spice/spice/-/merge_requests/140 * https://gitlab.freedesktop.org/spice/spice-protocol/-/merge_requests/22 This commit is a rebased and revised version of the patch by Kevin Pouget: https://www.spinics.net/lists/spice-devel/msg42582.html (I have confirmed with him that it's OK that I submit the updated patches.) Co-Authored-By: Kevin Pouget <kpouget@redhat.com> Co-Authored-By: Joan Bruguera <joanbrugueram@gmail.com>
2021-08-23Add support for SNI connecting trough TLSFrediano Ziglio1-0/+13
This will pass hostname. This fixes https://gitlab.freedesktop.org/spice/spice-gtk/-/issues/137. You can easily verify the change with a network capture program running something like remote-viewer spice+tls://www.spice-space.org:443 you will see the hostname in the initial exchange. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-20Support USB emulation for MacOSFrediano Ziglio2-0/+31
Use proper ioctls for MacOS. Import new spice-common to solve an issue detecting Python3. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
2021-08-20Use Glib macros for endian managementFrediano Ziglio3-21/+12
Resolve some portability issue, like MacOS. Macros from <endian.h> were used but not all systems have this header. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
2021-06-28Remove incorrect volatile usageMarc-André Lureau2-6/+6
See also: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-06-28Fix potential div0 crashMarc-André Lureau1-3/+5
gdk_monitor_get_geometry() may return 0-size, and leads to crash: https://bugzilla.redhat.com/show_bug.cgi?id=1941627 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-23main: annotate some signal pointersMarc-André Lureau1-4/+4
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-17Fix parsing the usbids fileBastien Orivel1-1/+1
This fixes a regression from 032ca202f839fe1c49cddfd2b0459f9fecc23c86 where a check on whether the usbids file contained anything but the wrong variable was checked. This is visible on windows when trying to share a USB device as devices won't get named based on the usbids file. Same thing on linux if we can't read the name from the sysfs. `usbids_vendor_info` is only initialized to something not NULL after it was checked to be different from NULL which is obviously wrong. The patch wanted to check that the `usbids_vendor_count` was different from 0 instead. Acked-by: Frediano Ziglio <freddy77@gmail.com>
2021-04-13Annotate spice_uuid_to_stringMarc-André Lureau1-1/+1
Note: that unusual function seems problematic for GI in general, we may want a simple pointer instead.. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-13Annotate SpiceDisplayChannel:monitorsMarc-André Lureau1-1/+1
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-13Annotate a few DispayChannel methods taking Channel as argumentMarc-André Lureau1-14/+14
Help bindings by setting those functions as DisplayChannel methods. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-10spice-widget: add spice_display_keyboard_ungrab()Paul Donohue5-1/+21
Internally, spice-widget has separate try_keyboard_ungrab() and try_mouse_ungrab() functions to ungrab the keyboard and mouse respectively. Both of these functions are called when the grab sequence is pressed. spice-widget exposes try_mouse_ungrab() as spice_display_mouse_ungrab() to allow callers to explicitly ungrab. However, it does not currently expose try_keyboard_ungrab(), so callers can only ungrab the mouse and cannot ungrab the keyboard. Correct this by exposing try_keyboard_ungrab() as spice_display_keyboard_ungrab(). Fixes #73
2021-04-09Add clipboard function array annotationsMarc-André Lureau1-6/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-09Fix spice_display_channel_change_preferred_video_codec_types annotationsMarc-André Lureau1-2/+2
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-09Fix g-i class size bindingMarc-André Lureau6-6/+7
gir fails to compute the size of the array, which results in invalid class size. Deprecate usage of SPICE_RESERVED_PADDING, which isn't that useful anyway. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-09Add some ABI size checks for what we are modifying nextMarc-André Lureau5-0/+10
We are about to modify the struct fields, let's make sure we don't break the ABI. Once check-abi is added to our CI, this shouldn't be needed, and can probably be reverted. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-04-09Rename spice_cairo_is_scaled -> allow_scalingMarc-André Lureau3-4/+4
As it is just a getter for allow_scaling. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-02-19gstaudio: remove record bus watch to release GstBusJakub Janků1-1/+10
The GSource added by gst_bus_add_watch() apparently holds a reference to the GstBus. This can be seen by running GST_DEBUG="GST_TRACER:7" GST_TRACERS="leaks" spicy: GST_TRACER :0:: object-alive, type-name=(string)GstBus, address=(gpointer)0x1e76db0, description=(string)<bus6>, ref-count=(uint)1, trace=(string); (note that gst_deinit() must be called for this output to be shown, which doesn't happen in virt-viewer; see 0381e62) To fix this, save the source's id returned by gst_bus_add_watch() and remove the source when the pipe is unreferenced. Signed-off-by: Jakub Janků <jjanku@redhat.com>
2021-02-19spicy: destroy all windows on disconnectionJakub Janků1-0/+3
SpiceWidget holds a strong reference on the SpiceSession. If the windows are not destroyed, the session isn't freed either. session_disconnect() does destroy all the channels, but other objects aren't released until the session's dispose (audio manager, usb manager, webdav). Signed-off-by: Jakub Janků <jjanku@redhat.com>
2021-02-17spicy-connect: unref GMainLoopJakub Janků1-0/+1
Signed-off-by: Jakub Janků <jjanku@redhat.com>
2021-01-29widget: notify about existing gl scanouts on registering channelMarc-André Lureau1-0/+4
Show the current GL scanout, if any already. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-01-29egl: don't call gl_make_current if context isn't readyMarc-André Lureau1-1/+1
This avoids a critical warning. The function will eventually be called again on realize. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-12-01Release v0.39v0.39Victor Toso2-2/+25
Bumping libtool current & age as new symbol was added to libspice-client-glib-2.0.so: spice_main_channel_update_display_mm() Signed-off-by: Victor Toso <victortoso@redhat.com>
2020-12-01spicy: use the scale factor to get the display preferred dimensionMarc-André Lureau1-0/+2
Since commit b30598293b1c48b9dc0eddfde5a9fc996a83939c ("spice-widget: fix widget size request on HiDPI when scaling is disabled"), the widget requested size is divided by the scale factor. Multiply it back to get the guest display size (a more precise version would retrive the associated channel and get the "width" and "height" property from it) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-12-01Revert "spice-widget: ensure a 640x480 initial size on HiDPI"Marc-André Lureau1-6/+9
This reverts commit cbdda3334724f5bb7afe9e21ce0e972e53e71fdc. This commit doesn't actually do anything useful.
2020-12-01Revert "spice-widget: add an API to get guest display size"Marc-André Lureau5-23/+2
This reverts commit 18dfbb9e7974d153a1758aef58208591111de80e. The motivation behind the new API isn't clear enough. The guest display size can be retrieved through the "width" and "height" properties of the associated display channel. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-11-23spice-utils: allocate ctx after g_return_val_if_failUri Lublin1-1/+1
Fix the following issue: Error: RESOURCE_LEAK src/spice-util.c:235: alloc_fn: Storage is returned from allocation function "whc_new". src/spice-util.c:235: var_assign: Assigning: "ctx" = storage returned from "whc_new(instance_obj, gobject)". src/spice-util.c:237: leaked_storage: Variable "ctx" going out of scope leaks the storage it points to. 235| WeakHandlerCtx *ctx = whc_new (instance_obj, gobject); 236| 237|-> g_return_val_if_fail (G_TYPE_CHECK_INSTANCE (instance), 0); 238| g_return_val_if_fail (detailed_signal != NULL, 0); 239| g_return_val_if_fail (c_handler != NULL, 0); Signed-off-by: Uri Lublin <uril@redhat.com>
2020-11-23usb-backend: create_emulated_device: assert address < 32Uri Lublin1-0/+3
This may fix the following static analyzer issue: src/usb-backend.c:1507: large_shift: In expression "1 << address", left shifting by more than 31 bits has undefined behavior. The shift amount, "address", is 32. Signed-off-by: Uri Lublin <uril@redhat.com>
2020-11-23mark_false_event_id is guint, assign 0 to it not FALSEUri Lublin1-1/+1
Signed-off-by: Uri Lublin <uril@redhat.com>
2020-11-23sink_event_probe: do not keep duration in a variableUri Lublin1-2/+2
If not ENABLE_RECORDER, then duration is assigned a value but is never used - as the compiler optimizes it out. Fixes the following clang warning: src/channel-display-gst.c:443:21: warning: Value stored to 'duration' during its initialization is never read Signed-off-by: Uri Lublin <uril@redhat.com>
2020-11-23spice_usbutil_parse_usbids: verify at least one vendor and productUri Lublin1-0/+7
Fixes the following clang warning: src/usbutil.c:148:52: warning: Use of zero-allocated memory ... product_info[product_count].product_id = id; ^ 146| while (isspace(line[0])) 147| line++; 148|-> product_info[product_count].product_id = id; 149| snprintf(product_info[product_count].name, 150| PRODUCT_NAME_LEN, "%s", line); Signed-off-by: Uri Lublin <uril@redhat.com>
2020-11-11empty_cd_clicked_cb: g_free basenameUri Lublin1-1/+3
Fix the following static analyzer warning: src/usb-device-widget.c:224: leaked_storage: Failing to save or free storage allocated by "g_path_get_basename(filename)" leaks it. Signed-off-by: Uri Lublin <uril@redhat.com>
2020-10-22Update spice-common submoduleFrediano Ziglio1-0/+0
This brings in the following changes: Frediano Ziglio (10): proto: Add support for side mouse buttons quic: Constify a parameter quic: Fix typo in comment agent: Extend agent_check_message to support VDAgentMonitorsConfig extension quic: Check we have some data to start decoding quic image quic: Check image size in quic_decode_begin quic: Check RLE lengths quic: Avoid possible buffer overflow in find_bucket test-quic: Add fuzzer capabilities to the test test-quic: Add test cases for quic fuzzer Marc-André Lureau (1): agent: fix vdagent monitor flag filtering In particular some security related changes are imported. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-22usb-backend: Fix spice-usbredir-redirect-on-connect optionFrediano Ziglio1-1/+1
After commit 3e20f17b90598e740c4e274b81d99f28187da800 (cfr "usb-redir: extend USB backend to support emulated devices") this option stopped working, as devices are not redirected. Data for device to guest were not written during initialisation. With this fix both spice-usbredir-redirect-on-connect and spice-share-cd are working (even together). This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1874740. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-10-05channel-main: Add comment on handling GLib I/O error statusesFrediano Ziglio1-0/+3
Document a behaviour in the code asked a couple of times. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-09-21meson: add a summary for the various options and infosMarc-André Lureau2-8/+28
Bump meson requirement to >= 0.53 for summary(). Remove some debug message() Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-16channel-main: Handle not terminated host_data and cert_subject_data fieldsFrediano Ziglio1-2/+3
host_data and cert_subject_data fields from SPICE messages could be not NUL terminated so using g_strdup can lead to some read overflow. This bug was discovered by Uri Lublin. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-09-16channel-main: Make more clear that host_data and cert_subject_data are C stringsFrediano Ziglio1-6/+2
After commit ab42be2b00d12d0bc98c6ddea08a7f969e83b2ac ("channel-main: Copy SpiceMigrationDstInfo into spice_migrate") host_data and cert_subject_data fields in spice_migrate structure are proper terminated C strings so: - check pointer instead of related field; - you don't need to terminate again. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-09-16channel-main: Copy SpiceMigrationDstInfo into spice_migrateFrediano Ziglio1-4/+11
The message could disappear while the structure is used. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-09-16channel-main: Use heap and reference counting for spice_migrateFrediano Ziglio1-32/+78
Don't use the stack, it will potentially disappear (see mig variable in main_migrate_connect). For instance channels use this structure when they are freed. As the free is done in delayed mode the initial coroutine could be ended releasing the stack and causing a segmentation fault. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1867564. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Uri Lublin <uril@redhat.com>
2020-09-16widget: set physical display dimensions (with resize-guest=true)Marc-André Lureau1-4/+24
Note that Gtk+ doesn't provide a convenient & reliable API to get the dimensions of a widget. See the gitlab issue in the comment. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-16main: add display physical size supportMarc-André Lureau4-8/+81
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2020-09-16main: add stricter pre-condition on display id valueMarc-André Lureau1-2/+2
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>