Partially revert commit
51ede38ee5 ("build: Tell SPICE common the
SPICE protocol version we require") as spice-gtk depends on
specific spice-protocol version as well.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
"surface" parameters is normally attached to "surfaces" hash table
but in case surface is reused the buffer is not freed.
This problem was reported by Ding Fei.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This reverts commit 4b9092b96b
"session: make spice_session_get_webdav_server() public".
Instead of publishing the function to access the PhodavServer
from spice-gtk-session.c, install a new read-only property
"webdav-server" and use g_object_get() to retrieve it.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
When an app advertises the "text/uri-list" target, the user
probably wants to copy/move files. Spice-gtk then sends
a grab message to the vdagent advertising the
VD_AGENT_CLIPBOARD_FILE_LIST type.
Vdagent can then request clipboard data in this type.
Spice-gtk tries to talk to the app that owns the clipboard
in its native format in order to determine the preferred
file operation (copy X move).
For GNOME Nautilus, that's simply "UTF8_TEXT",
for KDE Dolphin, "application/x-kde-cutselection".
Otherwise the generic "text/uri-list" is used that does not
provide any additional information.
Once the uri list is obtained from the app, spice-gtk
creates a unique virtual dir in the ".spice-clipboard"
directory that is designated for this purpose.
Each file is attached inside this virtual dir using
phodav_virtual_dir_attach_real_child(), see phodav API
for details.
A list of paths in the phodav server is then sent to vdagent,
as specified in the spice-protocol.
Such path can for example look like this:
/.spice-clipboard/b8f0249c-082a-4da9-9a38-2de3237a66f0/file
It is up to the vdagent to ensure that the spice shared folder
is accessible and to set the clipboard data in a format that
other apps understand.
This requires new phodav with PhodavVirtualDir API.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
At the moment, spice-gtk only sends a grab message to the vdagent
based on the retrieved atoms.
With the upcoming changes, spice-gtk will have to know which
targets were advertised outside of clipboard_get_targets() callback.
We could use gtk_clipboard_wait_for_targets() or
gtk_clipboard_wait_is_*_available(), but the targets are not cached
by GTK+ on wayland for some reason. So let's cache them in spice-gtk
to avoid having to talk to the clipboard owner.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
File copy&paste functionality will only be enabled when there is an open
webdav channel.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This adds g_uuid_string_random()
which is necessary for the following file copy&paste
functionality.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Phodav 2.5 brings PhodavVirtualDir API needed for the
file copy and paste functionality.
If the library version is not sufficient, this new feature
will be disabled, but the standard shared folders can still
be used.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
It will be necessary to access the webdav server from spice-gtk-session.c
which isn't compiled with spice-session-priv.h, so make
spice_session_get_webdav_server() public.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This brings in the following changes:
Frediano Ziglio (19):
canvas_base: Format canvas_draw_blend similarly to canvas_draw_copy
canvas_base: Rename blend to copy for canvas_draw_blend argument
canvas_base: Remove canvas_draw_blend/canvas_draw_copy duplication
build: Remove dependency to gio2 from common and server libraries
build: Remove dependencies to libgthread
test-utils: Add missing include file
test-quic: Test fixed images
test-quic: Different "more_space" function for decode and encode
Reuse macros from spice-protocol
rect: Avoid usage of "small"
build: Remove -Werror from Meson build
snd_codec: Use better types for snd_codec_is_capable
snd_codec: Use better type for function result
snd_codec: Use better type for snd_codec_create mode
backtrace: Do not attempt to compile if spice_backtrace is empty
Avoid usage of GCC extension for __VA_ARGS__ where possible
helper-fuzzer-demarshallers: Provide replacement for ftello for MSVC
quic_tmpl: Remove unused bpc parameter
ssl_verify: Do not check IP if we fail to resolve it
Haochen Tong (2):
pixman_utils: fix clang "unused functions" warning
marshal: fix clang "missing field initializer" warning on generated files
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
qmp-port.c:
warning: Although the value stored to 'node' is used in the enclosing
expression, the value is never actually read from 'node'
usb-backend.c:
warning: Value stored to 'done' is never read
warning: Use of memory after it is freed
usb-device-cd.c:
warning: Value stored to 'error' is never read
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Instead of using ucontext and setjmp together just use setjmp and
limit ucontext usage to initialise the initial jmp_buf context.
This simplifies the code and reduce number of context operations done.
In particular using _setjmp/_longjmp moving from a context to
another does not require any system call.
On x64 the continuation structure is reduced from 2176 to 248 bytes.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Changing stack is not usually instrumentation friendly.
Allows to enable the usage of Valgrind memcheck calling some
valgrind macros.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Caps the minimum scale of the mouse cursor to 50% so that it is still
visible even if the window is too small.
This also workarounds a GDK warning when SpiceDisplay is used in
remote-viewer. Upon its initialization there is a possible race
condition, where update_mouse_cursor is called but the widget still has
a size of 1x1. In such case, the calculated scale is very small and the
mouse surface width and height are both zero, causing a warning:
gdk_cursor_new_from_surface: assertion '0 <= x && x < cairo_image_surface_get_width (surface)' failed
Signed-off-by: Haochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Make mouse cursor size scale with the window size on Cairo/EGL client
mouse and Cairo server mouse. The cursor size should always be the same
as how big it really is inside the virtual machine.
Signed-off-by: Haochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
GDK scales hotspot coordinates using screen scale factor on X11. We need
to undo this to get the correct hotspot behavior, otherwise mouse
selection becomes very inaccurate and difficult in the guest.
See [1].
[1] https://gitlab.gnome.org/GNOME/gtk/-/blob/3.24.21/gdk/x11/gdkcursor-x11.c#L556-557
Signed-off-by: Haochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
On HiDPI displays, guest screen used to be blurry because the screen
size is smaller than the widget size, and is scaled up. This patch fixes
that by considering scale factor when calculating geometry.
Signed-off-by: Haochen Tong <i@hexchain.org>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
Using a single "caller" global does not allow to store multiple
coroutines so use "caller" inside coroutine structure.
Also correctly set the current coroutine returning in coroutine_swap.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Not used and implemented in different ways by the various
coroutine implementations
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Only used by different coroutine implementations
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Do not pass always G_IO_OUT. In case SSL_connect is waiting for
data and error was SSL_ERROR_WANT_READ instead of SSL_ERROR_WANT_WRITE
this was creating a tight loop repeatedly calling SSL_connect till
data arrived.
Note that G_IO_ERR and G_IO_HUP are always detected so no need to
add them.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Code was duplicate in 2 places.
The or operation ("|") was not necessary as condition was reset to
0 some lines above in both functions.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
OldRedMigrationBegin is not used. Last usage removed in
commit f944ad6935
More cleanup for old protocol support
Support for protocol version 1 was dropped in commit f77a1d50.
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
If we read 0 bytes from the phodav server,
the client connection was closed by the server.
In that case, remove the client immediately,
instead of waiting for the data to be written to the mux channel.
Fixes: https://lists.freedesktop.org/archives/spice-devel/2020-July/051765.html
I believe that the underlying issue, that is causing the described problems,
is that libsoup closes the connection after each request
although the webdav client wanted it to be persistant (keep-alive).
Filed an issue for libsoup:
https://gitlab.gnome.org/GNOME/libsoup/-/issues/195
Additionally, spice-webdavd does not close the connection
when it receives 0-size message for a given webdav client.
As a result, single webdav client can send multiple request using one
connection to spice-webdavd, but in spice-gtk for each request
a new client with the same id must be created.
This leads to basically a race condition when there's still the
client with the given id in the hash table, but the connection
was already closed by libsoup/phodav server. So a new client should
be started but the old closed one is used. The write op then
naturally fails with the following error and the request is lost:
../spice-gtk-0.38/src/channel-webdav.c:325 webdav-11:0: write failed: Stream is already closed
So check whether the output stream is closed before demuxing.
Also add some debug messages.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This is a follow-up to 228caca239 (!52)
85ed26847c left some residues
in spice-session-priv.h, remove them.
Signed-off-by: Jakub Janků <jjanku@redhat.com>
When `build-aux/git-version-gen` is not able to find the project
version (no git tags and no `.tarball-version`), it returns 'UNKNOWN'
or 'UNKNOWN-dirty' (instead of the project version like
`0.38.28-d79b`).
This `UNKNOWN` value fails `meson build` command:
src/meson.build:9:0: ERROR: Index 1 out of bounds of array of size 1.
With this patch, we set a default major/minor/micro value when the
actual version is unknown. This is the same as the `autoconf`
historical behavior.
See spice#41.
Signed-off-by: Kevin Pouget <kpouget@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>