summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Introduce spice_usb_acl_helper_cancel()Jonathon Jongsma2016-03-113-1/+15
| | | | | | | | | | | This function explicitly cancels a open_acl() task. It is similar to close_acl(), but its behavior is more explicit. This function is very similar to the existing close_acl() function but it requires that the task has not already been completed. Also, although it releases its reference on priv->result to avoid circular references, it doesn't call cleanup(), preferring instead to wait for the destructor to clean up. This makes the close_acl() function essentially pointless and will be removed in the following commit.
* spice-gtk: Fix the signedness of a couple of mm-time tracesFrancois Gouget2016-02-231-2/+2
| | | | | Signed-off-by: Francois Gouget <fgouget@codeweavers.com> Acked-by: Marc-André Lureau <mlureau@redhat.com>
* namedpipelistener: do not leak the error messageIgnacio Casal Quinteiro2016-02-231-0/+1
|
* Simplify spice_usb_device_manager_device_to_libdev()Christophe Fergeau2016-02-181-6/+1
| | | | | | The Windows-specific version duplicates some code from spice_usb_device_equal_libdev(), this commit switches to using that helper instead.
* Simplify spice_usb_device_equal_libdev()Christophe Fergeau2016-02-181-9/+4
| | | | | | The Windows-specific version duplicates some code from spice_usb_device_manager_libdev_match(), this commit switches to using that helper instead.
* gtk: add spice-widget GL scanout supportMarc-André Lureau2016-02-166-21/+779
| | | | | | | | | | | | | | | | Hook to spice-glib events to show the GL scanout. The opengl context is created with egl, and is currently x11-only (supporting wayland with bare-egl doesn't seem trivial). Using GtkGLArea is left for a future series, since SpiceDisplay widget is a GtkDrawingArea and can't be replaced without breaking ABI. Furthermore, GtkGLArea won't work on non-egl contexts, so this approach is necessary on gtk+ < 3.16 or X11 (because gdk/x11 uses glx). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
* glib: add local GL scanout supportMarc-André Lureau2016-02-135-3/+195
| | | | | | | | | | | | | | Add spice-glib support for gl scanout messages. A note about SpiceGlScanout: it is struct with scanout details, registered as a boxed type, with associated gl-scanout property. That way, it doesn't need a seperate signal for change notification and the current scanout can be retrieve with gobject getter. Since boxed property are always duplicated by g_object_get(), an additional spice_display_get_gl_scanout() method returns the current scanout without duplication (that's what spice-gtk display widget will use). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Add spice_channel_unix_read_fd()Marc-André Lureau2016-02-132-0/+71
| | | | | | Utility function used in the messages with socket ancillary fd. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* typo: s/GTask/GSimpleAsyncResultFabiano Fidêncio2016-02-121-1/+1
| | | | | | | | | Seems that I messed up with cd0c1008316e90bce925e1448ffcabb366e88f8f while rebasing my GTask series on top of this patch, causing a build breakage due to non-intentional insertion of a GTask replacing a GSimpleAsyncResult. Acked-by: Pavel Grunt <pgrunt@redhat.com>
* Use #ifdef {HAVE,USE}_FOO instead of #if {HAVE,USE}_FOOFabiano Fidêncio2016-02-127-26/+26
| | | | | | | | | | | | | | | | | | | While "#if USE_FOO" checks for the value of the variable USE_FOO, "#ifdef" checks whether USE_FOO is defined or not. It means, if we had something like: #define USE_FOO 0, we would have: #if USE_FOO /* Any code in here would NOT be compiled */ #endif #ifdef USE_FOO /* Any code in here would be compiled */ #endif No problem was faced on spice-gtk till now because either USE_FOO is not defined or defined as 1, but let's try to have it standardized. Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* gtk: replace configure-event for size-allocateMarc-André Lureau2016-02-031-7/+4
| | | | | | | | | | For size-allocate, it's simpler to connect to the signal rather than override the default signal handler since there is no automatic chaining to parent handler otherwise. Doing this removes the need to have a window. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Victor Toso <victortoso@redhat.com>
* usb-device-{manager,widget}: Add counter of free channelsFabiano Fidêncio2016-01-222-5/+47
| | | | | | | | | | As the message showed when the last usbredir channel is taken can be a bit confusing, let's add a counter of free channels to the widget's label. In order to add the counter, a new property for SpiceUsbDeviceManager was introduced ("free-channels"). Related: rhbz#1298772
* Remove GSLice usageFabiano Fidêncio2016-01-227-21/+22
| | | | | It's being slowly deprecated in glib https://bugzilla.gnome.org/show_bug.cgi?id=754687
* gstaudio: set output parameter to NULL on errorVictor Toso2016-01-191-0/+4
| | | | | | | | This is not really triggered in the current code but this is usually expected in case of errors; Also, the same function on record side already does this. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* build-sys: silence vala deprecated function usage warningsMarc-André Lureau2016-01-141-0/+1
| | | | | | | This silence usage of deprecated glib declarations from vala generated code. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* channel-main: remove unused header rect.hVictor Toso2016-01-071-1/+0
| | | | | | | It was included in be8ff99571478deb5c8d116134f65ed2b788dbd3 but with no use. Acked-by: Marc-André Lureau <mlureau@redhat.com>
* build-sys: remove xrandrMarc-André Lureau2016-01-041-3/+0
| | | | | | Not needed anymore (probably since gnome-rr was removed in 30986505b) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Grab keyboard based on session focus.snir sheriber2015-12-213-2/+44
| | | | | | | | | | | | | | | | | | | | When using multiple monitors moving mouse between monitors releases keyboard grab. Reproduce bug -Open multiple monitors remote-viewer session -Click on one of the monitors to get focus & keyboard-grab -Move mouse to another monitor and try keyboard command (do not click) At this point all keyboard commands are being executed on the client machine instead of the remote machine I added keyboard_has_focus and mouse_has_pointer variables at the session and now these properties are being tested for the session instead for the current widget (works also when using alt-tab). Resolves: rhbz#1275231 Acked-by: Pavel Grunt <pgrunt@redhat.com>
* ppc: Fix spicy-screenshot colors on BE machinesLukas Venhoda2015-12-211-0/+6
| | | | | | Save screenshot in proper endianess xRGB on LE machine and BGRx on BE machine Acked-by: Pavel Grunt <pgrunt@redhat.com>
* ppc: Fix colors on ppc when using GLZLukas Venhoda2015-12-211-1/+1
| | | | | Fixes color order on PowerPC when using GLZ image compression. Acked-by: Pavel Grunt <pgrunt@redhat.com>
* ppc: Fix message endianessFabiano Fidêncio2015-12-211-24/+37
|
* ppc: Fix header endianessFabiano Fidêncio2015-12-211-10/+10
|
* Call spice_marshaller_flush on message writeJavier Celaya2015-12-101-0/+1
| | | | | | | | | spice_marshaller_flush must be called before writing a message to calculate pointer offsets. This is only an issue when ptr submarshallers are used, which currently is only used by Tunnel::service_add. Since this is disabled by default, this buug is not going to be hit by the current codebase.
* gst: Fix typo in preprocessor symbolChristophe Fergeau2015-12-091-2/+2
| | | | | When the GStreamer backend is used, HAVE_GSTAUDIO is defined, not HAVE_GST_AUDIO.
* smartcard: Fix compilation with older libcacardChristophe Fergeau2015-12-092-0/+8
| | | | | | | | e0c2182937 dropped some #include from channel-smartcard.c and spicy.c as they were redundant with the headers already included from spice-common/common/messages.h. While this is true for the newer libcacard.h header, we need to include more headers to support older libcacard, or compilation breaks.
* spice-gtk: Recover from GStreamer audio initialization errorsFrancois Gouget2015-12-091-5/+7
| | | | | | | gst_init() will terminate the program in case of a failure so it's better to use gst_init_check() so we can recover from errors. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* build-sys: Allow simultaneous support for Pulse and GStreamer audioFrancois Gouget2015-12-082-7/+8
| | | | | | | | | | Rather than GStreamer/PulseAudio backend being mutually exclusive at compile-time, this commit allows to enable both at the same time. PulseAudio will then be favoured, with a fallback to GStreamer if it's not available. Note that --with-audio is kept for backward compatibility. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* Use libcacard.h if possibleMarc-André Lureau2015-12-083-10/+5
| | | | | | Drop unneeded includes (that are already undirectly included). Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
* Fix use after free of uriMarc-André Lureau2015-12-081-1/+1
| | | | | | | | "path" points to "uri" memory, move free(uri) later. Found thanks to valgrind :) Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
* build-sys: Prefix the configure audio GStreamer variables with GSTAUDIO_Francois Gouget2015-11-241-2/+2
| | | | | | | | This lets us avoid naming conflicts when using GStreamer for other purposes. Signed-off-by: Francois Gouget <fgouget@codeweavers.com> Acked-by: Victor Toso <victortoso@redhat.com>
* file transfer: send cancel message when user cancels a transferJay.han2015-11-191-1/+2
| | | | | | | | | When a user cancel's a file transfer, we should send a STATUS_CANCELED message rather than an STATUS_ERROR message. The latter triggers a bug in the vdagent where the file remains opened by the vdagent in the guest and cannot be removed. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
* Be more specific in the case of authentication errorMarek Kasik2015-11-193-5/+31
| | | | | | | | This patch adds SPICE_CLIENT_ERROR_AUTH_NEEDS_USERNAME error for the case when authentication fails because of missing username. This can happen when GSSAPI method is used. https://bugs.freedesktop.org/show_bug.cgi?id=92994
* spicy: Add support for changing compressionPavel Grunt2015-11-181-0/+63
|
* channel-display: Add spice_display_change_preferred_compressionPavel Grunt2015-11-184-7/+37
|
* Do not export symbol of non-existent functionPavel Grunt2015-11-112-2/+0
|
* file xfer: Fix segfault when rebootingJonathon Jongsma2015-11-101-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent changes to file transfer introduced a regression where the client would crash when rebooting a guest after performing a file transfer. This was caused because the SpiceFileTransferTask is freed when it is completed, but is not removed from the MainChannel's hash table. When we reboot the guest and lose our vdagent connection, we iterate through the list of tasks in the hash table and complete them. But since we did not remove the already-completed tasks from this hash table, this hash table contains already-freed memory. To fix the issue, take an extra ref for the async operations (so that completing the task won't free an object that is stored in the hash table). In addition, connect to the task's "finished" signal and remove it from the hash table when it becomes finished. Bug reported via email by Jay.han <ezzzehxx@gmail.com>. Valgrind report below: ==6926== Invalid read of size 8 ==6926== at 0x508177B: spice_file_transfer_task_completed (channel-main.c:2941) ==6926== by 0x50846DC: set_agent_connected (channel-main.c:462) ==6926== by 0x5073A43: spice_channel_recv_msg (spice-channel.c:1892) ==6926== by 0x5073BE3: spice_channel_iterate_read (spice-channel.c:2132) ==6926== by 0x5075D25: spice_channel_coroutine (spice-channel.c:2170) ==6926== by 0x50A6EFE: coroutine_trampoline (coroutine_ucontext.c:63) ==6926== by 0x50A6CC8: continuation_trampoline (continuation.c:55) ==6926== by 0x65C2B5F: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so) ==6926== by 0x151331C7: ??? ==6926== Address 0x29971fd8 is 168 bytes inside a block of size 184 free'd ==6926== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==6926== by 0x5E33142: g_type_free_instance (in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4000.0) ==6926== by 0x50815DA: file_xfer_close_cb (channel-main.c:1826) ==6926== by 0x5AEBD5C: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4000.0) ==6926== by 0x5B0F41A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4000.0) ==6926== by 0x5B0F438: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.4000.0) ==6926== by 0x609BCE4: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0) ==6926== by 0x609C047: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0) ==6926== by 0x609C309: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4000.0) ==6926== by 0x4058AB: main (spicy.c:1858)
* spice-gtk: Fix error handling in stream_get_current_frame()Francois Gouget2015-11-041-8/+9
| | | | | | *data must always be set to NULL on error. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
* channel-usbredir: drop isoc packets on low bandwidthVictor Toso2015-10-303-1/+35
| | | | | | | | | | | | | | | | | | | | When channel wants to send much more data then the wire can handle, the queue grows fast. This patch does not limit the queue growth but introduces an internal API to check if queue size is too big. This internal API is used in usbredir_buffered_output_size_callback which is called before any isoc pacaket is queued in usbredir. The usbredir implements the logic to: - only drop isoc packets - while dropping packtes does still give us video frames from and above 10fps streams An easy way to test locally is sharing and webcam and with tc: tc qdisc add dev lo root netem delay 100ms tc qdisc change dev lo root netem delay 1000ms tc qdisc del dev lo root netem Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1264156
* Remove noisy debug statementJonathon Jongsma2015-10-221-1/+0
| | | | | This isn't terribly useful for general debugging and makes the log pretty noisy when transferring large files.
* Don't print error message on successful file transferJonathon Jongsma2015-10-221-14/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain circumstances we were printing an error message even though the file transfer had completed successfully. It didn't cause any problems, but it pointed out an issue in the handling of outgoing agent messages. The described behavior was generally only encountered when there were multiple files being transferred at once, and most often when one or two files were significantly smaller than another file being transferred. For example, two 20kB files and another 3MB file. The failure mechanism is basically as follows: For each file transfer, we read a chunk for the file and then we queue a series of messages to the guest and wait for them to be flushed before continuing to read a new chunk of the file. (Since the maximum agent message size is 2kB, each 64kB chunk of file being read can generate up to 32 messages at a time). The file transfer task remains in "pending" state until the flush operation is complete. Since all agent messages go into a single channel-wide queue, waiting for the messages to be flushed meant waiting for *all* outgoing messages to be flushed, including those that were queued after we called flush_async(). Since agent messages can only be sent if the client has enough agent tokens, it can take a little while for all queued messages to be sent. This means that even if a file transfer task has sent out all of its data to the guest, it can be kept in "pending" state for some time if other file transfer tasks or other agent messages are added to the queue. In this situation, The guest might notice that it has received all of the data for a file transfer task and send a XFER_STATUS_SUCCESS message while we're still in "pending" state. This patch changes to code so that flush_async() only waits for the currently-queued messages to be sent. This means that it is not affected by any new messages that get added to the outgoing queue after we've called flush_async(). This means that the task will exit "pending" state immediately after sending out our last data packet. Fixes: rhbz#1265562
* MainChannel: move task free from finalize to disposeJonathon Jongsma2015-10-221-2/+2
| | | | | | | | In order to avoid reference cycles, you're supposed to release references in dispose, especially to those objects that can hold references to yourself. This probably wasn't causing any leaks, since the file transfer tasks generally are not alive when the main channel is destroyed, but it's more proper.
* FileTransferTask: ensure we emit 'finished' signalJonathon Jongsma2015-10-151-1/+2
| | | | | | | | | | | | | | | In the case where a file cannot be opened for reading, we were not emitting a 'finished' signal to communicate the error to the client. I was intending to further fix this issue by 'rejecting' the drop (in SpiceDisplay) when the URI list contains invalid files (e.g. directories). This would prevent a 'new-file-transfer' signal from even being emitted for these invalid files. But this turns out to be not very useful since there's no real feedback given to the user to indicate why the drop failed. So it's probably better for client applications to get the 'new-file-transfer' and 'finished' signals so that they can present the error to the user to explain why the attempted transfer did not work.
* Free display_cache in cache_unrefChristophe Fergeau2015-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Otherwise it will be leaked. There is no cache_ref function, or helper increasing a refcount/taking a reference so cache_unref really is a cache_free method. This fixes: ==27687== 64 bytes in 4 blocks are definitely lost in loss record 250 of 435 ==27687== at 0x4C28C50: malloc (vg_replace_malloc.c:299) ==27687== by 0xA6AF058: g_malloc (gmem.c:94) ==27687== by 0xA6C5982: g_slice_alloc (gslice.c:1007) ==27687== by 0x40F112: cache_new (spice-channel-cache.h:54) ==27687== by 0x40F112: cache_image_new (spice-channel-cache.h:64) ==27687== by 0x40F112: spice_session_init (spice-session.c:294) ==27687== by 0xA239B4A: g_type_create_instance (gtype.c:1870) ==27687== by 0xA21C31A: g_object_new_internal (gobject.c:1779) ==27687== by 0xA21DB10: g_object_newv (gobject.c:1926) ==27687== by 0xA21E3FB: g_object_new (gobject.c:1619) ==27687== by 0x40FF4D: spice_session_new (spice-session.c:1479) ==27687== by 0x40E678: test_session_uri (session.c:35) ==27687== by 0xA6CE47A: test_case_run (gtestutils.c:2158) ==27687== by 0xA6CE47A: g_test_run_suite_internal (gtestutils.c:2241) ==27687== by 0xA6CE642: g_test_run_suite_internal (gtestutils.c:2253)
* Rename display_cache::cache_unref to cache_freeChristophe Fergeau2015-10-144-4/+4
| | | | | | | | | | display_cache is no longer refcounted since commit c9d4773, but this is not an issue as even before, the fact that it was refcounted was not used as there was no corresponding cache_ref() call (and g_hash_table_ref() was not called directly either). As the next commit will free memory from cache_unref() rather than just releasing a reference, it's better to make it obvious that this method is a _free() method rather than an _unref() one.
* New file transfer APIJonathon Jongsma2015-10-097-136/+679
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were several shortcomings to the existing file transfer API, particularly in terms of monitoring ongoing file transfers. The major issue is that spice_main_file_copy_async() allows you to pass an array of files, but the progress callback does not provide a way to identify which file the callback is associated with. This makes it nearly impossible for an application to monitor file transfers. In addition, the SpiceDisplay widget automatically handles drag-and-drop actions on the widget, and initiates file transfers without allowing the application to specify a progress callback. So there's no way for an app to monitor file transfers that are initiated via drag and drop. http://lists.freedesktop.org/archives/spice-devel/2015-September/021931.html has a more detailed explanation of the issues. This change doesn't break the existing API, but adds some new API that will allow an application to monitor file transfer progress, even for transfers that are initiated within spice-gtk itself. - A new public SpiceFileTransferTask object is added. - The SpiceMainChannel object gains a "new-file-transfer" signal that is emitted whenever a new file transfer is initiated. The SpiceFileTransferTask object is passed to the signal handler. - The application can retain this object and monitor its 'progress' property to be notified when the progress of the file transfer changes. The SpiceFileTransferTask::finished signal indicates when the given file transfer has completed. The application can also cancel the file transfer by calling the _cancel() method. The 'spicy' test application has been updated to use this new API and display a simple dialog showing the progress of individual files.
* Fix progress monitoring in spice_main_file_copy_asyncJonathon Jongsma2015-10-091-4/+24
| | | | | | | | | | | | | | | spice_main_file_copy_async() allows you to pass a NULL-terminated array of files to transfer to the guest. It also allows you to pass a progress_callback function to monitor the progress of the transfer, but this progress callback is called separately for each file that is transferred, and there are no parameters that allow the caller to determine which file a given callback corresponds to. This makes it very difficult to monitor the progress. To make this more usable, I've changed it so that the progress callback doesn't simply report the number of bytes read and total size of the current file. Instead, we add up the status of all current transfers and report that value to the callback.
* Don't wrap included headers in G_BEGIN|END_DECLSJonathon Jongsma2015-10-093-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Only the local declarations should be declared extern "C", otherwise it can result in unexpected errors such as this (encountered while re-ordering some include statements for a different patch): CC channel-inputs.lo In file included from /usr/include/glib-2.0/glib/gmacros.h:38:0, from /usr/lib64/glib-2.0/include/glibconfig.h:9, from /usr/include/glib-2.0/glib/gtypes.h:32, from /usr/include/glib-2.0/glib/galloca.h:32, from /usr/include/glib-2.0/glib.h:30, from /usr/include/glib-2.0/gobject/gbinding.h:28, from /usr/include/glib-2.0/glib-object.h:23, from /usr/include/glib-2.0/gio/gioenums.h:28, from /usr/include/glib-2.0/gio/giotypes.h:28, from /usr/include/glib-2.0/gio/gio.h:26, from ../../src/spice-channel.h:27, from ../../src/channel-inputs.h:25, from ../../src/channel-inputs.c:20: /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stddef.h:147:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef' typedef __PTRDIFF_TYPE__ ptrdiff_t; ^
* Gtk applications should only include spice-client-gtk.hJonathon Jongsma2015-10-099-3/+52
| | | | | | This header is the single include needed for all gtk-related functionality, similar to spice-client.h. Generate a compiler warning if a different header is included.
* Glib applications should only include spice-client.hJonathon Jongsma2015-10-0938-17/+98
| | | | | Generate a compiler warning if an application attempts to include a different header.
* Fix documentation for spice_main_file_copy_async()Jonathon Jongsma2015-09-281-1/+1
| | | | | 'sources' should be a NULL-terminated array, but the parameter documentation treats it as if it is a single file object.