[Spice-devel] [PATCH spice-gtk 2/2] webdav: ref client when demuxing

2019-08-20 Thread Jakub Janků
The client can be unrefed before the demux_to_client_cb() is called which could lead to segfault. So ref it first before starting the async write. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/channel-webdav.c b/src

[Spice-devel] [PATCH spice-gtk 1/2] vmcstream: fix task cancellation

2019-08-20 Thread Jakub Janků
t-CRITICAL **: 15:39:46.168: g_object_unref: assertion 'G_IS_OBJECT (object)' failed To fix this, call spice_vmc_write_finish() immediately in the corresponding write_cb(). Signed-off-by: Jakub Janků --- src/vmcstream.c | 23 --- 1 file changed, 12 insertions(+), 1

[Spice-devel] [PATCH spice-gtk] webdav: fix usecase with multiple concurrent connections

2019-08-08 Thread Jakub Janků
ned-off-by: Jakub Janků --- src/channel-webdav.c | 17 +++-- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/channel-webdav.c b/src/channel-webdav.c index 14d4e05..09ef9f7 100644 --- a/src/channel-webdav.c +++ b/src/channel-webdav.c @@ -235,7 +235,7 @@ mux_msg_

[Spice-devel] [PATCH spice-gtk] spice-file-xfer-task: unref properties on dispose

2019-07-31 Thread Jakub Janků
When the construction properties are set, the objects are referenced by g_value_dup_object(), so they should be unref once the task is done. If the main channel stays referenced, spice session fails to disconnect and the viewer does not close. Signed-off-by: Jakub Janků --- Hi, it seems a bit

[Spice-devel] [PATCH phodav 1/2] spice: read_thread: return number of read bytes on EOF

2019-07-22 Thread Jakub Janků
We already check with each input_stream_read_thread_finish() whether the count of the read bytes matches the requested one. Also, this is the way GLib handles it. Signed-off-by: Jakub Janků --- https://gitlab.gnome.org/GNOME/phodav/merge_requests/4 I've opened the merge request on gitlab

[Spice-devel] [PATCH phodav 2/2] spice: handle client disconnect gracefully

2019-07-22 Thread Jakub Janků
ff-by: Jakub Janků --- spice/spice-webdavd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index 81b4d91..e1e0f5c 100644 --- a/spice/spice-webdavd.c +++ b/spice/spice-webdavd.c @@ -251,11 +251,13 @@ mux_data_read_cb (GO

[Spice-devel] [PATCH spice-gtk v2] webdav: don't buffer input from phodav

2019-07-03 Thread Jakub Janků
to be disconnected, the write operations need to be cancelled so that the references to the channel are released asap. Otherwise, spice session would be stuck waiting for the channel to finalize. Signed-off-by: Jakub Janků --- Changes since v1: * updated commit log and comment --- src/channel-webdav.c

[Spice-devel] [PATCH spice-gtk] webdav: don't buffer input from phodav

2019-07-01 Thread Jakub Janků
annel are released asap. Otherwise, spice session would be stuck waiting for the channel to finalize. Signed-off-by: Jakub Janků --- Note: I left the OutputQueue code still in place since I'm considering using it for the drag&drop functionality. src/channel

[Spice-devel] [PATCH spice-gtk] spice-channel: return if has_error is TRUE in spice_channel_write_msg

2019-06-26 Thread Jakub Janků
ed that can be seen if the channel gets disconnected by the session while having non-empty write queue. spice_session_channel_destroy() sets channel->priv->session to NULL, but spice_channel_write_msg() subsequently attempts to call spice_session_get_read_only() with NULL pointer. Signe

[Spice-devel] [PATCH spice-gtk v2] file-transfer-task: emit signals in main context

2019-06-24 Thread Jakub Janků
spice_main_channel_clipboard_selection_grab from the coroutine context prints an error as we try to switch to a coroutine we are already in. Such issues are probably not likely, but the fix is easy. Signed-off-by: Jakub Janků --- src/spice-file-transfer-task.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[Spice-devel] [PATCH spice-gtk] file-transfer-task: emit signals in main context

2019-06-24 Thread Jakub Janků
Some parts of the internal file transfer task API can be invoked in the coroutine context, so in these cases use g_coroutine_signal_emit and g_coroutine_object_notify. Signed-off-by: Jakub Janků --- src/spice-file-transfer-task.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[Spice-devel] [PATCH spice-gtk v2 5/5] webdav: don't warn on cancel

2019-06-19 Thread Jakub Janků
The IO operation is cancelled on channel dispose and it is not an error, so silence the warnings. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/channel-webdav.c b/src/channel-webdav.c index a8cdcbc

[Spice-devel] [PATCH spice-gtk v2 4/5] webdav: remove client on empty message

2019-06-19 Thread Jakub Janků
Message with no data from spice-webdav daemon means the client disconnected. In this case, the client connection to phodav should be closed as well. This can happen e.g. when file transfer gets cancelled. Also, while we're at it, reorder the code a bit. Signed-off-by: Jakub Janků ---

[Spice-devel] [PATCH spice-gtk v2 1/5] gio-pipe: fix NULL pointer dereferencing

2019-06-19 Thread Jakub Janků
p2); g_output_stream_write_all_async(p1_out); g_clear_object(p2); g_pollable_output_stream_is_writable(p1_out); Signed-off-by: Jakub Janků --- src/giopipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/giopipe.c b/src/giopipe.c index de1adae..fcec844 100644 --- a/src/giopipe.c +++ b/

[Spice-devel] [PATCH spice-gtk v2 2/5] vmcstream: finish task immediately when reading 0 bytes

2019-06-19 Thread Jakub Janků
The current implementation finishes it only after new data arrives from the channel (or after it is cancelled). Signed-off-by: Jakub Janků --- src/vmcstream.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/vmcstream.c b/src/vmcstream.c index 86c949a..b6f6d1a 100644 --- a/src

[Spice-devel] [PATCH spice-gtk v2 3/5] webdav: don't start client on empty message

2019-06-19 Thread Jakub Janků
case, ignore the message and start demuxing again. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/channel-webdav.c b/src/channel-webdav.c index 822fee0..4e08efa 100644 --- a/src/channel-webdav.c +++ b/src/ch

[Spice-devel] [PATCH spice-gtk 1/5] gio-pipe: fix NULL pointer dereferencing

2019-06-17 Thread Jakub Janků
p2); g_output_stream_write_all_async(p1_out); g_clear_object(p2); g_pollable_output_stream_is_writable(p1_out); Signed-off-by: Jakub Janků --- src/giopipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/giopipe.c b/src/giopipe.c index de1adae..fcec844 100644 --- a/src/giopipe.c +++ b/

[Spice-devel] [PATCH spice-gtk 3/5] webdav: don't start client on empty message

2019-06-17 Thread Jakub Janků
case, ignore the message and start demuxing again. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/channel-webdav.c b/src/channel-webdav.c index 822fee0..ea287f1 100644 --- a/src/channel-webdav.c +++ b/src/ch

[Spice-devel] [PATCH spice-gtk 5/5] webdav: don't warn on cancel

2019-06-17 Thread Jakub Janků
The IO operation is cancelled on channel dispose and it is not an error, so silence the warnings. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/channel-webdav.c b/src/channel-webdav.c index 34d88a9..7bec2a0

[Spice-devel] [PATCH spice-gtk 2/5] vmcstream: finish task immediately when reading 0 bytes

2019-06-17 Thread Jakub Janků
The current implementation finishes it only after new data arrives from the channel (or after it is cancelled). Signed-off-by: Jakub Janků --- src/vmcstream.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/vmcstream.c b/src/vmcstream.c index 86c949a

[Spice-devel] [PATCH spice-gtk 4/5] webdav: remove client on empty message

2019-06-17 Thread Jakub Janků
Message with no data from spice-webdav daemon means the client disconnected. In this case, the client connection to phodav should be closed as well. This can happen e.g. when file transfer gets cancelled. Signed-off-by: Jakub Janků --- src/channel-webdav.c | 4 ++-- 1 file changed, 2

[Spice-devel] [PATCH phodav 03/13] spice: handle SIGINT properly

2019-05-23 Thread Jakub Janků
According to [0], g_debug should not be used in a signal handler. So, to avoid reentrancy, do not print debug message when quit is called with SIGINT. [0] https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/signal?view=vs-2019 Signed-off-by: Jakub Janků --- spice/spice-webdavd.c

[Spice-devel] [PATCH phodav 07/13] spice: unref GSocketAddress

2019-05-23 Thread Jakub Janků
No need to keep it around after calling g_socket_listener_add_address(). Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index d9b1fae..681e909 100644 --- a/spice/spice-webdavd.c +++ b/spice

[Spice-devel] [PATCH phodav 02/13] spice: rename my_input_channel

2019-05-23 Thread Jakub Janků
my_input_channel_* isn't saying much, let's rename it to input_channel_*_thread, which is more fitting. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 48 +-- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/spice/spice-w

[Spice-devel] [PATCH phodav 06/13] spice: print err when g_open fails

2019-05-23 Thread Jakub Janků
Don't fail silently when we cannot open the webdav virtio port. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index 3fac28b..d9b1fae 100644 --- a/spice/spice-webdavd.c +++ b/spice/

[Spice-devel] [PATCH phodav 11/13] spice: move OutputQueue to file

2019-05-23 Thread Jakub Janků
OutputQueue is a self-contained unit and as such can be put in a separate file to make the spice-webdavd.c less cluttered. Also, as the current implementation defines output_queue_{ref, unref}, turn OutputQueue into a GObject which can handle these for us. Signed-off-by: Jakub Janků --- spice

[Spice-devel] [PATCH phodav 04/13] spice: quit service quickly

2019-05-23 Thread Jakub Janků
We shouldn't wait for 1 second if the service is supposed to stop. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index cdfa73d..6ad63c5 100644 --- a/

[Spice-devel] [PATCH phodav 00/13] Miscellaneous series

2019-05-23 Thread Jakub Janků
Hi, this series contains mostly fixes of some things that I came across while reading the spice-webdavd.c code, without any order. Cheers, Jakub Janků (13): spice: remove G_SOURCE_{REMOVE,CONTINUE} definitions spice: rename my_input_channel spice: handle SIGINT properly spice: quit

[Spice-devel] [PATCH phodav 12/13] rename README to README.md

2019-05-23 Thread Jakub Janků
The filename needs the proper extension for GitLab to handle the file as a Markdown file. Fix some style issues so that the file renders correctly. Signed-off-by: Jakub Janků --- README => README.md | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) rename REA

[Spice-devel] [PATCH phodav 13/13] rename NEWS to NEWS.md

2019-05-23 Thread Jakub Janků
The filename needs the proper extension for GitLab to handle the file as a Markdown file. Signed-off-by: Jakub Janků --- NEWS => NEWS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename NEWS => NEWS.md (100%) diff --git a/NEWS b/NEWS.md similarity index 100% rename from NEWS

[Spice-devel] [PATCH phodav 05/13] spice: clear loop pointer on unref

2019-05-23 Thread Jakub Janků
The pointer to loop must be set to NULL on unref. Quit signal handler can be called at any time, using g_main_loop_quit() on a freed loop could lead to segfault. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spice

[Spice-devel] [PATCH phodav 01/13] spice: remove G_SOURCE_{REMOVE, CONTINUE} definitions

2019-05-23 Thread Jakub Janků
Other symbols that were added after G_SOURCE_{REMOVE, CONTINUE} are already being used in the rest of the file - e.g. g_task_new, so there's no need to define these. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/spice/

[Spice-devel] [PATCH phodav 09/13] spice-win: remove MapDriveEnum

2019-05-23 Thread Jakub Janků
The enum doesn't add much value, let's remove it. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 19 +++ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index c77c870..29058e7 100644 --- a/spice/spice

[Spice-devel] [PATCH phodav 08/13] spice-win: define SERVICE_NAME

2019-05-23 Thread Jakub Janků
Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index 681e909..c77c870 100644 --- a/spice/spice-webdavd.c +++ b/spice/spice-webdavd.c @@ -31,6 +31,7 @@ #include #include

[Spice-devel] [PATCH phodav 10/13] spice-win: don't assign drive_letter on error

2019-05-23 Thread Jakub Janků
drive_letter should be assigned only when the mapping was successful. Signed-off-by: Jakub Janků --- spice/spice-webdavd.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c index 29058e7..f2c7f07 100644 --- a/spice

[Spice-devel] [vdagent-linux v2 3/5] udscs: use GObject macro

2019-04-30 Thread Jakub Janků
Use G_DECLARE_FINAL_TYPE(). Rename struct udscs_connection --> UdscsConnection Signed-off-by: Jakub Janků --- src/udscs.c | 15 ++- src/udscs.h | 28 +++- src/vdagent/clipboard.c | 8 src/vdagent/clipboard.h |

[Spice-devel] [vdagent-linux v2 4/5] virtio: use GObject macro

2019-04-30 Thread Jakub Janků
Use G_DECLARE_FINAL_TYPE(). Rename struct vdagent_virtio_port --> VirtioPort Signed-off-by: Jakub Janků --- src/vdagentd/vdagentd.c| 18 +- src/vdagentd/virtio-port.c | 16 src/vdagentd/virtio-port.h | 31 --- 3 files changed,

[Spice-devel] [vdagent-linux v2 1/5] build: add GIO dependency

2019-04-30 Thread Jakub Janků
: 2.56 RHEL 7.5: 2.54 RHEL 7.4: 2.50 Debian 10:2.58 Debian 9: 2.50 Debian 8: 2.42 Ubuntu 19.04: 2.60 Ubuntu 18.04: 2.56 Ubuntu 16.04: 2.48 Signed-off-by: Jakub Janků --- Makefile.am | 12 ++-- configure.ac | 2 +- 2 files changed

[Spice-devel] [vdagent-linux v2 0/5] VDAgentConnection

2019-04-30 Thread Jakub Janků
ous (doesn't use the "hack" with GMainLoop) Cheers, Jakub Janků (5): build: add GIO dependency introduce VDAgentConnection udscs: use GObject macro virtio: use GObject macro udscs-server: split initialization Makefile.am| 14 +- configure.ac |

[Spice-devel] [vdagent-linux v2 5/5] udscs-server: split initialization

2019-04-30 Thread Jakub Janků
the code a bit shorter and nicer. Signed-off-by: Jakub Janků --- src/udscs.c | 63 +++-- src/udscs.h | 28 +- src/vdagentd/vdagentd.c | 24 ++-- 3 files changed, 38 insertions(+), 77 deletions(-) diff --git a

[Spice-devel] [vdagent-linux v2 2/5] introduce VDAgentConnection

2019-04-30 Thread Jakub Janků
e_fds() 4) vdagentd Replace the main_loop() with a GMainLoop. Use g_unix_signal_add() to handle SIGINT, SIGHUP, SIGTERM. SIGQUIT handling is not supported by GLib. Integrate the session_info into the loop using GIOChannel and g_io_add_watch(). Signed-off-by: Jakub Janků --- M

[Spice-devel] [PATCH spice-gtk] spice-option: translate entries

2019-04-17 Thread Jakub Janků
Translation strings for spice options are already present in the respective PO files. g_option_group_set_translation_domain() call needs to be made, so that the strings marked with N_() actually get translated at runtime. Signed-off-by: Jakub Janků --- src/spice-option.c | 1 + 1 file changed

[Spice-devel] [PATCH spice-gtk v2] gettext: fix ngettext usage

2019-04-17 Thread Jakub Janků
hin a wrong domain. Fix ngettext usage in usb-device-widget.c and update the PO files accordingly. Signed-off-by: Jakub Janků --- po/de.po| 9 +++-- po/fr.po| 11 --- po/it.po| 12 +--- src/usb-device-widget.c | 7 --- 4

[Spice-devel] [PATCH spice-gtk] gettext: fix ngettext usage

2019-04-17 Thread Jakub Janků
_() should not be used in conjunction with ngettext(), otherwise it's impossible to properly translate the message into languages that have multiple plural forms, such as Czech. Fix ngettext usage in usb-device-widget.c and update the PO files accordingly. Signed-off-by: Jakub Janků --

[Spice-devel] [PATCH spice-gtk 0/3] clipboard grab race

2019-02-28 Thread Jakub Janků
Hi, this is another try to solve the grab race. Intention of these patches is to make spice-gtk behave reasonably well with older agents. The next step would be to fix the protocol itself. But that will require updating spice-gtk as well as vdagents. Cheers, Jakub Jakub Janků (3): clipboard

[Spice-devel] [PATCH spice-gtk 1/3] clipboard: accept grab only from the side with keyboard focus

2019-02-28 Thread Jakub Janků
k/issues/82 Related: https://bugzilla.redhat.com/show_bug.cgi?id=1594876 Signed-off-by: Jakub Janků --- Victor, half of this patch is basically yours, so feel free to add signed-off or something, in the case this gets upstream :) --- src/spice-gtk-session.c | 13 + 1 file changed, 13 inser

[Spice-devel] [PATCH spice-gtk 3/3] clipboard: invalidate targets request when needed

2019-02-28 Thread Jakub Janků
-off-by: Jakub Janků --- This addresses the same issue that was present in spice-vdagent and is already fixed. --- src/spice-gtk-session.c | 39 +-- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c

[Spice-devel] [PATCH spice-gtk 2/3] clipboard: release on both sides if race occurs

2019-02-28 Thread Jakub Janků
om us when we cannot provide it. Current implementation can cause hangs, as has been reported: https://gitlab.freedesktop.org/spice/win32/vd_agent/issues/6 Related: https://gitlab.freedesktop.org/spice/spice-gtk/issues/82 Related: https://bugzilla.redhat.com/show_bug.cgi?id=1594876 Signed-off-by:

[Spice-devel] [vdagent-linux] x11: invalidate requests for targets on grab from client

2019-02-21 Thread Jakub Janků
up in a situation when vdagent holds the clipboard grab in the guest but cannot provide data to the apps that request it - this can be observed in the log: clipboard: received selection request event for target *, while not owning client clipboard Signed-off-by: Jakub Janků --- This

[Spice-devel] [PATCH vdagent-linux] clipboard: cancel request for targets on grab from client

2019-02-17 Thread Jakub Janků
vdagent holds clipboard grab in the guest but cannot provide data to the apps that request it - this can be observed in the log: CRITICAL **: 20:48:55.782: clipboard_get_cb: assertion 'c->selections[sel_id].owner == OWNER_CLIENT' failed Signed-off-by: Jakub Janků --- The same bug

[Spice-devel] [spice-gtk] clipboard: don't request targets without owner on X11

2019-01-27 Thread Jakub Janků
On X11, if the owner in GdkEventOwnerChange is set to NULL, it means there's no data in the clipboard, so it's pointless to request targets as the request will fail anyway. On Wayland, owner is always NULL, so don't do anything there. Signed-off-by: Jakub Janků --- src/spice-gt

[Spice-devel] [PATCH vdagent-linux 2/4] vport: add @err to disconnect_callback

2018-09-30 Thread Jakub Janků
@err parameter to the vdagent_virtio_port_disconnect_callback: 1) disconnect was initiated by vdagent_virtio_port_destroy() --> @err is NULL 2) disconnect was caused by an IO error --> @err is set accordingly Signed-off-by: Jakub Janků --- src/vdagentd/virtio-port.

[Spice-devel] [PATCH vdagent-linux 4/4] udscs-server: split initialization

2018-09-30 Thread Jakub Janků
the code a bit shorter and nicer. Signed-off-by: Jakub Janků --- src/udscs.c | 56 + src/udscs.h | 27 +--- src/vdagentd/vdagentd.c | 24 +++--- 3 files changed, 33 insertions(+), 74 deletions(-) diff

[Spice-devel] [PATCH vdagent-linux 0/4] GLib & GIO integration: VDAgentConnection

2018-09-30 Thread Jakub Janků
into "introduce VDAgentConnection" Cheers, Jakub Janků (4): build: add GIO dependency vport: add @err to disconnect_callback introduce VDAgentConnection udscs-server: split initialization Makefile.am| 4 + configure.ac | 1 + src/udscs.c

[Spice-devel] [PATCH vdagent-linux 1/4] build: add GIO dependency

2018-09-30 Thread Jakub Janků
POSIX I/O functions dealing with file descriptors. Version 2.44 is required because of the follwing definitions: - g_input_stream_read_all_* - g_output_stream_write_all_* - GSimpleIOStream Signed-off-by: Jakub Janků --- Makefile.am | 2 ++ configure.ac | 1 + 2 files changed, 3 insertions

[Spice-devel] [PATCH vdagent-linux 3/4] introduce VDAgentConnection

2018-09-30 Thread Jakub Janků
SIGINT, SIGHUP, SIGTERM. SIGQUIT handling is not supported by GLib. Integrate the session_info into the loop using GIOChannel and g_io_add_watch(). Signed-off-by: Jakub Janků --- Makefile.am| 2 + src/udscs.c| 483 +++-- src

[Spice-devel] [PATCH vdagent-linux] udscs: simplify traffic logging

2018-09-21 Thread Jakub Janků
Remove @type_to_string, @no_types arguments from udscs_connect(), udscs_create_server{,_for_fd}(). udscs is used only in vdagent.c and vdagentd.c and in both cases the args are the same (vdagentd_messages, VDAGENTD_NO_MESSAGES). Add debug_print_message_header(). Signed-off-by: Jakub Janků

[Spice-devel] [PATCH vdagent-linux 5/6] vdagentd: move code to do_agent_file_xfer_status()

2018-09-07 Thread Jakub Janků
Move code handling VDAGENTD_FILE_XFER_STATUS messages from agent_read_complete() to a separate function to make the switch statement less cluttered. Simplify the code a bit. Signed-off-by: Jakub Janků --- src/vdagentd/vdagentd.c | 54 +++-- 1 file changed

[Spice-devel] [PATCH vdagent-linux 4/6] vdagentd: move code to do_agent_xorg_resolution()

2018-09-07 Thread Jakub Janků
Move code handling VDAGENTD_GUEST_XORG_RESOLUTION messages from agent_read_complete() to a separate function to make the switch statement less cluttered. Remove unnecessary res variable. Signed-off-by: Jakub Janků --- src/vdagentd/vdagentd.c | 62 ++--- 1

[Spice-devel] [PATCH vdagent-linux 1/6] move to GLib memory functions

2018-09-07 Thread Jakub Janků
for simplification. Replace subsequent alloc and memcpy calls with single g_memdup where possible. Note: this commit only partially touches src/vdagent/x11.c as the clipboard-handling code here should be removed in the future. Signed-off-by: Jakub Janků --- src/udscs.c

[Spice-devel] [PATCH vdagent-linux 2/6] udscs: return void in udscs_write{, _all}()

2018-09-04 Thread Jakub Janků
The functions would return -1 only if malloc() failed, otherwise 0. Since malloc() was replaced by g_malloc(), which terminates the program if the allocation fails, return void instead. Signed-off-by: Jakub Janků --- src/udscs.c | 13 - src/udscs.h | 5 ++--- 2 files changed, 6

[Spice-devel] [PATCH vdagent-linux 5/6] vdagentd: move code to do_agent_file_xfer_status()

2018-09-04 Thread Jakub Janků
Move code handling VDAGENTD_FILE_XFER_STATUS messages from agent_read_complete() to a separate function to make the switch statement less cluttered. Improve formatting a bit. Signed-off-by: Jakub Janků --- src/vdagentd/vdagentd.c | 61 + 1 file changed

[Spice-devel] [PATCH vdagent-linux 3/6] vport: return void in vdagent_virtio_port_write{, _start}()

2018-09-04 Thread Jakub Janků
The functions would return -1 only if malloc() failed, otherwise 0. Since malloc() was replaced by g_malloc(), which terminates the program if the allocation fails, return void instead. Signed-off-by: Jakub Janků --- src/vdagentd/virtio-port.c | 15 +-- src/vdagentd/virtio-port.h

[Spice-devel] [PATCH vdagent-linux 4/6] vdagentd: move code to do_agent_xorg_resolution()

2018-09-04 Thread Jakub Janků
Move code handling VDAGENTD_GUEST_XORG_RESOLUTION messages from agent_read_complete() to a separate function to make the switch statement less cluttered. Remove unnecessary res variable. Signed-off-by: Jakub Janků --- src/vdagentd/vdagentd.c | 62 + 1

[Spice-devel] [PATCH vdagent-linux 6/6] file-xfer: remove obsolete GLIB_CHECK_VERSION

2018-09-04 Thread Jakub Janků
Required GLib version was bumped from 2.28 to 2.34 by 61fc548fe1a323dd2344c8ae267e3ce05e86da7d. Signed-off-by: Jakub Janků --- src/vdagent/file-xfers.c | 5 - 1 file changed, 5 deletions(-) diff --git a/src/vdagent/file-xfers.c b/src/vdagent/file-xfers.c index 6461d05..0fabe7e 100644 --- a

[Spice-devel] [PATCH vdagent-linux 0/6] clean-up series

2018-09-04 Thread Jakub Janků
y rewrite udscs, virtio-port, systemd-login and console-kit. Regards, Jakub Jakub Janků (6): move to GLib memory functions udscs: return void in udscs_write{,_all}() vport: return void in vdagent_virtio_port_write{,_start}() vdagentd: move code to do_agent_xorg_resolution() vdagent

[Spice-devel] [PATCH vdagent-linux 1/6] move to GLib memory functions

2018-09-04 Thread Jakub Janků
mplification. Note: this commit only partially touches src/vdagent/x11.c as the clipboard-handling code here should be removed in the future. Signed-off-by: Jakub Janků --- src/udscs.c | 60 ++-- src/vdagent/x11-randr.c | 54 ++

[Spice-devel] [PATCH vdagent-linux] vdagentd: parse argv using GLib

2018-09-04 Thread Jakub Janků
-session -X, --disable-session-integration Change the types of some global variables that hold the options: - const char * --> gchar * - int --> gboolean Define DEFAULT_UINPUT_DEVICE as "/dev/uinput", since there's already DEFAULT_VIRTIO_PORT_PATH, VDAGENTD_SOCKET.

[Spice-devel] [RFC spice-vdagent 18/18] vdagentd: move code to do_agent_file_xfer_status()

2018-08-14 Thread Jakub Janků
Move code handling VDAGENTD_FILE_XFER_STATUS from agent_read_complete() to a separate function to make the switch statement less cluttered. Improve formatting a bit. --- src/vdagentd/vdagentd.c | 61 + 1 file changed, 37 insertions(+), 24 deletions(-) diff

[Spice-devel] [RFC spice-vdagent 16/18] move to GLib memory functions

2018-08-14 Thread Jakub Janků
Some older parts of the code currently use memory functions defined in stdlib.h and usually handle allocation errors. On the other hand, newer parts of the code and GLib/GTK+ functions themselves commonly use wrappers provided by GLib that terminate the program when there isn't enough memory. So

[Spice-devel] [RFC spice-vdagent 17/18] vdagentd: move code to do_guest_xorg_resolution()

2018-08-14 Thread Jakub Janků
Move code handling VDAGENTD_GUEST_XORG_RESOLUTION from agent_read_complete() to a separate function to make the switch statement less cluttered. Remove unnecessary res variable. --- src/vdagentd/vdagentd.c | 61 + 1 file changed, 31 insertions(+), 30 deleti

[Spice-devel] [RFC spice-vdagent 12/18] console-kit: use GDBus

2018-08-14 Thread Jakub Janků
Rewrite console-kit.c using GDBus instead of libdbus. GDBus provides a more convenient way to access DBus objects. All DBus method calls share a fair amount of common code here, so add a helper function dbus_call_method_for_string(). --- src/vdagentd/console-kit.c | 597 --

[Spice-devel] [RFC spice-vdagent 09/18] udscs: simplify logging

2018-08-14 Thread Jakub Janků
Remove type_to_string, no_types arguments from udscs_connect() and udscs_server_new(). udscs is used only in vdagent.c and vdagentd.c and in both cases the args are the same (vdagentd_messages, VDAGENTD_NO_MESSAGES). Add debug_print_message_header(). --- src/udscs.c | 52 +

[Spice-devel] [RFC spice-vdagent 06/18] udscs: add udscs_get_peer_pid()

2018-08-14 Thread Jakub Janků
udscs_get_peer_cred() is currently used only in vdagentd.c to obtain PID, so let's drop udscs_get_peer_cred() and add udscs_get_peer_pid() instead. --- src/udscs.c | 6 +++--- src/udscs.h | 4 ++-- src/vdagentd/vdagentd.c | 2 +- 3 files changed, 6 insertions(+), 6 deletion

[Spice-devel] [RFC spice-vdagent 15/18] build: drop DBus dependency

2018-08-14 Thread Jakub Janků
Both console-kit.c and systemd-login.c have been moved to GDBus. --- Makefile.am | 2 -- configure.ac | 1 - 2 files changed, 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index b291b19..64ed406 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,7 +47,6 @@ src_spice_vdagent_SOURCES =

[Spice-devel] [RFC spice-vdagent 10/18] vport: use VDAgentConnection

2018-08-14 Thread Jakub Janků
Rewrite virtio-port.c using VDAgentConnection to integrate it into GMainLoop and simplify the code. virtio_port_destroy() does NOT close the underlying FD immediately. GSources attached to GMainContext can be processed during vdagent_virtio_port_flush() call. Apart from that, the behavior stays th

[Spice-devel] [RFC spice-vdagent 05/18] add VDAgentConnection

2018-08-14 Thread Jakub Janků
Add a set of helper functions built around GIO that can be used to easily write messages to and read from the given FD. Since VDAgentConnection uses GIO, it integrates well with GMainLoop. Read messages must begin with a header of a fixed size. Message body size can vary. User of VDAgentConnecti

[Spice-devel] [RFC spice-vdagent 14/18] session-info: remove session_info_get_fd()

2018-08-14 Thread Jakub Janků
In console-kit.c, FD polling is handled internally by GDBus. In systemd-login.c, FD is integrated into the GMainLoop using GIOChannel. Users of session-info.h are notified by ActiveSessionChangeCb when the active session changes. This renders the session_info_get_fd() obsolete. --- src/vdagentd

[Spice-devel] [RFC spice-vdagent 08/18] udscs-server: split initialization

2018-08-14 Thread Jakub Janků
Divide creation of udscs_server into 2 steps: 1) udscs_server_new() - allocates new udscs_server struct and inits it 2) udscs_server_listen_to_fd(), udscs_server_listen_to_address() - starts accepting new connections udscs_server_listen_to_address() creates a new socket and binds it to the giv

[Spice-devel] [RFC spice-vdagent 04/18] build: add GIO dependency

2018-08-14 Thread Jakub Janků
Require UNIX-specific GIO package to build spice-vdagent. This includes - GDBus which is going to be used instead of libdbus in console-kit.c and systemd-login.c - I/O stream classes and networking APIs that are going to be used in udscs.c and virtio-port.c instead of low-level POSIX I/O f

[Spice-devel] [RFC spice-vdagent 11/18] session-info: add ActiveSessionChangeCb

2018-08-14 Thread Jakub Janků
This is necessary for the following GDBus integration, which drops session_info_get_fd(). The vdagentd therefore won't be able to detect session changes using select(). --- src/vdagentd/console-kit.c| 2 +- src/vdagentd/dummy-session-info.c | 2 +- src/vdagentd/session-info.h | 4 +++

[Spice-devel] [RFC spice-vdagent 13/18] systemd-login: use GDBus

2018-08-14 Thread Jakub Janků
Rewrite systemd-login.c using GDBus instead of libdbus. Use GDBusProxy. This is less efficient than the previous impl as it caches all properties and listens to all signals of the given DBus object. But it is just so much more convenient... --- src/vdagentd/systemd-login.c | 254 +++--

[Spice-devel] [RFC spice-vdagent 07/18] udscs: use VDAgentConnection

2018-08-14 Thread Jakub Janků
Rewrite udscs.c using VDAgentConnection to integrate it into GMainLoop and simplify the code. udscs_destroy_connection() does NOT close the underlying FD immediately. Apart from that, the behavior stays the same. Drop support for select() in udscs_server, remove udscs_server_fill_fds(), udscs_ser

[Spice-devel] [RFC spice-vdagent 02/18] vport: add by_user param to vdagent_virtio_port_disconnect_callback

2018-08-14 Thread Jakub Janků
If the virtio port is destroyed explicitly by calling vdagent_virtio_port_destroy(), by_user is set to TRUE, otherwise to FALSE. This will be used later with GMainLoop. --- src/vdagentd/virtio-port.c | 24 +++- src/vdagentd/virtio-port.h | 10 +- 2 files changed, 20 in

[Spice-devel] [RFC spice-vdagent 01/18] vdagentd: parse argv using GLib

2018-08-14 Thread Jakub Janků
All command line options now have long names as they are required by GLib. Change types of some global variables that hold the options: - const char * --> gchar * - int --> gboolean Define DEFAULT_UINPUT_DEVICE as "/dev/uinput", since there's already DEFAULT_VIRTIO_PORT_PATH, VDAGENTD_SO

[Spice-devel] [RFC spice-vdagent 03/18] vdagentd: use GMainLoop

2018-08-14 Thread Jakub Janků
This is purely a preparatory patch as it renders the vdagentd non-functional. Remove main while loop with FD polling. udscs, virtio-port and session-info will be integrated into the GMainLoop in the following commits. Use g_unix_signal_add() to handle SIGINT, SIGHUP, SIGTERM. SIGQUIT handling is

[Spice-devel] [RFC spice-vdagent 00/18] GLib integration

2018-08-14 Thread Jakub Janků
n quit it (this would also require adding destruction callbacks for udscs_connection, udscs_server and virtio_port) Is there any better solution? Cheers, Jakub Jakub Janků (18): vdagentd: parse argv using GLib vport: add by_user param to vdagent_virtio_port_disconnect_callback vdagentd

[Spice-devel] [PATCH spice-vdagent] dummy-session-info: remove session_is_locked()

2018-07-23 Thread Jakub Janků
364b6bba068bd694d7c4355b6275f88482d9f3f8 introduced session_info_session_is_locked() in session-info.h, however dummy-session-info.c implemented session_is_locked() instead, causing builds with --with-session-info=none to fail. This was fixed by d66fbb9d12ae2e5dbaf13d23b9abb4b6bf187d7f, but it did

[Spice-devel] [RFC spice-vdagent 4/8] build: make GTK+ mandatory

2018-05-31 Thread Jakub Janků
Use GTK+ instead of Xlib where possible, remove Xlib code that handles clipboard. --- configure.ac| 13 +- src/vdagent/clipboard.c | 49 +- src/vdagent/clipboard.h |4 +- src/vdagent/vdagent.c | 14 +- src/vdagent/x11-priv.h | 94 src/vdagent/x11.c | 1177 +---

[Spice-devel] [RFC spice-vdagent 5/8] vdagentd-proto: specify new SELECTION messages

2018-05-31 Thread Jakub Janků
--- src/vdagentd-proto-strings.h | 10 ++ src/vdagentd-proto.h | 17 + 2 files changed, 27 insertions(+) diff --git a/src/vdagentd-proto-strings.h b/src/vdagentd-proto-strings.h index 6e7bcee..e76decc 100644 --- a/src/vdagentd-proto-strings.h +++ b/src/vdagentd-pro

[Spice-devel] [RFC spice-vdagent 7/8] clipboard: move code to send_*() functions

2018-05-31 Thread Jakub Janků
--- src/vdagent/clipboard.c | 162 ++-- 1 file changed, 106 insertions(+), 56 deletions(-) diff --git a/src/vdagent/clipboard.c b/src/vdagent/clipboard.c index 63f8527..b8bb0ad 100644 --- a/src/vdagent/clipboard.c +++ b/src/vdagent/clipboard.c @@ -96,6 +96,83 @

[Spice-devel] [RFC spice-vdagent 8/8] clipboard: implement new SELECTION protocol

2018-05-31 Thread Jakub Janků
--- src/vdagent/clipboard.c | 207 src/vdagent/clipboard.h | 11 +++ src/vdagent/vdagent.c | 15 +++ src/vdagentd/vdagentd.c | 178 +- 4 files changed, 393 insertions(+), 18 deletions(-) diff --git a/src/vdagent/clipboar

[Spice-devel] [RFC spice-protocol 1/8] agent: Add new SELECTION messages

2018-05-31 Thread Jakub Janků
--- spice/vd_agent.h | 38 ++ 1 file changed, 38 insertions(+) diff --git a/spice/vd_agent.h b/spice/vd_agent.h index 7109ede..0d81740 100644 --- a/spice/vd_agent.h +++ b/spice/vd_agent.h @@ -91,6 +91,10 @@ enum { VD_AGENT_CLIENT_DISCONNECTED, VD_AGEN

[Spice-devel] [RFC spice-gtk 2/8] main: support VD_AGENT_SELECTION_* messages

2018-05-31 Thread Jakub Janků
These enable transferring arbitrary type of data unlike the VDAgentClipboard* messages that are restricted to types defined in spice protocol (and atom2agent[] in spice-gtk-session.c). This will later be used for clipboard and DND data. --- doc/reference/spice-gtk-sections.txt | 4 + src/channe

[Spice-devel] [RFC spice-vdagent 6/8] clipboard: add vdagent_clipboards_set_protocol()

2018-05-31 Thread Jakub Janků
--- src/vdagent/clipboard.c | 11 +++ src/vdagent/clipboard.h | 2 ++ src/vdagent/vdagent.c | 3 +++ 3 files changed, 16 insertions(+) diff --git a/src/vdagent/clipboard.c b/src/vdagent/clipboard.c index 101e535..63f8527 100644 --- a/src/vdagent/clipboard.c +++ b/src/vdagent/clipboard

[Spice-devel] [RFC 0/8] Clipboard - using MIME types

2018-05-31 Thread Jakub Janků
Hi, these patches introduce support for transferring arbitrary type of clipboard data between spice-gtk client and linux vdagent. At the moment, VDAgentClipboard* messages are used to exchange data. These messages use spice-defined identifiers to describe the type of data (such as VD_AGENT_CLI

[Spice-devel] [RFC spice-gtk 3/8] clipboard: implement new SELECTION protocol

2018-05-31 Thread Jakub Janků
If guest agent has VD_AGENT_CAP_SELECTION_DATA, use new VDAgentSelection* messages to transfer clipboard data. --- src/spice-gtk-session.c | 385 +++- 1 file changed, 305 insertions(+), 80 deletions(-) diff --git a/src/spice-gtk-session.c b/src/spice-gtk-sessio

[Spice-devel] [PATCH vdagent v3 1/2] vdagent: add new vdagent_clipboard_*() interface

2018-03-01 Thread Jakub Janků
From: Jakub Janků Introduce new functions to handle clipboard, add new files clipboard.[ch] This is only a preparatory patch for following GTK+ clipboard implementation. --- Makefile.am | 2 ++ src/vdagent/clipboard.c | 68 + src

[Spice-devel] [PATCH vdagent v3 2/2] vdagent: add GTK+ clipboard handling

2018-03-01 Thread Jakub Janků
From: Jakub Janků --- src/vdagent/clipboard.c | 416 +++- src/vdagent/clipboard.h | 6 +- src/vdagent/vdagent.c | 23 ++- src/vdagent/x11-priv.h | 44 ++--- src/vdagent/x11.c | 25 ++- src/vdagent/x11.h | 6 + 6 files changed

[Spice-devel] [PATCH vdagent 1/2] build: make GTK+ optional

2018-03-01 Thread Jakub Janků
From: Jakub Janků Add --with-gtk configure option. If used, favor GTK+ over Xlib. --- configure.ac | 13 - src/vdagent/vdagent.c | 8 +++- src/vdagent/x11.c | 6 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac

  1   2   3   >