It seems that ssize_t is int, while DWORD is long
Compiler warning (some whitespaces where added for readability):
../../../gtk/controller/test.c: In function 'read_from_pipe':
../../../gtk/controller/test.c:108:5: warning: passing argument 4 \
of 'ReadFile' from incompatible pointer type [enabled by default]
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:70:0,
from ../../../gtk/controller/test.c:27:
/usr/i686-w64-mingw32/sys-root/mingw/include/winbase.h:1426:29: note: expected \
'LPDWORD' but argument is of type 'ssize_t *'
Windows namedpipes behave a bit differently from Unix socket, and may
return incomplete read/write. By using 2 read/write() helpers, try to
complete the operation before returning. Since the IO operation may be
splitted over several call, we make sure the buffer pointer is on the
heap. We use exception for EOF or BROKEN_PIPE condition, which also
simplifies the code.
To really work with namedpipe, the giowin32streams need to be fixed as
well to handle concurrent read & write properly, see for details:
https://bugzilla.gnome.org/show_bug.cgi?id=679288
printf is redefined by glib/gi18n.h
In file included from ../spice-common/common/spice_common.h:29:0,
from ../spice-common/common/ring.h:23,
from spice-channel-cache.h:23,
from spice-session-priv.h:26,
from desktop-integration.c:29:
../spice-common/common/log.h:49:17: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/log.h:56:16: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
In file included from ../spice-common/common/canvas_base.h:25:0,
from decode.h:23,
from spice-session-priv.h:27,
from desktop-integration.c:29:
../spice-common/common/lz.h:22:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/lz.h:23:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
../spice-common/common/lz.h:24:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
CC spice-widget-enums.lo
desktop-integration.c: In function 'spice_desktop_integration_dispose':
desktop-integration.c:175:30: error: unused variable 'self'
[-Werror=unused-variable]
The keyboard focus may change while usb-device-manager is in the process of
redirecting a usb-device (as this may show a policykit dialog). Making
autoredir/automount setting changes while this is happening is not a good idea!
Since usb-device-manager already sets keyboard_grab_inhibit when it is
redirecting to allow the policykit dialog to show, we can use that to
inhibit usb-autoredir setting changes.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
We need to integrate closely with the desktop environment of the user in
several cases. Some examples are disabling auto-mounting when auto-usbredir
is active (rhbz#812972), and disabling the screensaver when fullscreen
(fdo#34793).
Unfortuntely these kinds of things require desktop environment specific
handling. Therefor this patch introduces a desktop-integration helper class,
which is to server as a container for all sort of desktop environment specific
functions.
For now it just supports disabling automounting under Gnome, but this will be
extended in the future.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
To better reflect what then function does, also rename the tracking variable
inside spice-gtk-session to match.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This patch changes the "do we have focus?" tracking, to keeping a counter with
how many widgets have focus. The reason for this is that sometimes multiple
spice-widgets can have focus at the same time, yes really! Sometimes (rarely,
hard to reproduce) the focus in event for one window arrives before the
focus out of the other window.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Only update the UsbDeviceManager's "auto-connect" property when
"auto-usb-redir" is set, otherwise leave it as is. This allows apps to
control UsbDeviceManager's "auto-connect" directly, without it getting reset
on every keyboard focus change.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This fixes the following compilation error:
channel-usbredir.c: In function 'spice_usbredir_channel_connect_device_async':
channel-usbredir.c:313:9: error: jump skips variable initialization [-Werror=jump-misses-init]
==25063== 12,827 (2,032 direct, 10,795 indirect) bytes in 127 blocks are definitely lost in loss record 9,477 of 9,502
==25063== at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063== by 0x3DE384D2BE: g_malloc (gmem.c:159)
==25063== by 0x3DE38616B1: g_slice_alloc (gslice.c:1003)
==25063== by 0x3DE38346B0: g_error_new_valist (gerror.c:393)
==25063== by 0x3DE3834A8C: g_set_error (gerror.c:560)
==25063== by 0x3DE4871108: g_socket_receive_with_blocking (gsocket.c:2513)
==25063== by 0x5B708E8: bio_gsocket_bread (bio-gsocket.c:56)
==25063== by 0x61AEBD8: BIO_read (bio_lib.c:212)
==25063== by 0x5ECAC5B: ssl3_read_n (s3_pkt.c:238)
==25063== by 0x5ECBD3D: ssl3_read_bytes (s3_pkt.c:318)
==25063== by 0x5ECD6CF: ssl3_get_message (s3_both.c:426)
==25063== by 0x5EC5AFB: ssl3_get_new_session_ticket (s3_clnt.c:1822)
==25063== 90 bytes in 3 blocks are definitely lost in loss record 7,354 of 9,502
==25063== at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==25063== by 0x3DE384D2BE: g_malloc (gmem.c:159)
==25063== by 0x3DE3862D0B: g_strdup (gstrfuncs.c:356)
==25063== by 0x5B961B5: spice_usb_device_manager_set_property (usb-device-manager.c:306)
==25063== by 0x3DE40148FB: g_object_constructor (gobject.c:1352)
==25063== by 0x3DE4015D70: g_object_newv (gobject.c:1713)
==25063== by 0x3DE401655F: g_object_new_valist (gobject.c:1830)
==25063== by 0x3DE485924D: g_initable_new_valist (ginitable.c:224)
==25063== by 0x3DE4859348: g_initable_new (ginitable.c:148)
==25063== by 0x5B97330: spice_usb_device_manager_get (usb-device-manager.c:770)
==25063== by 0x52D8C6B: spice_gtk_session_update_keyboard_focus (spice-gtk-session.c:845)
==25063== by 0x52D6DC1: spice_gtk_session_set_property (spice-gtk-session.c:238)
==25063== 120 bytes in 3 blocks are definitely lost in loss record 8,448 of 9,502
==25063== at 0x4A06F18: calloc (vg_replace_malloc.c:566)
==25063== by 0x68BB2E5: usbredirfilter_string_to_rules (usbredirfilter.c:54)
==25063== by 0x5B96123: spice_usb_device_manager_set_property (usb-device-manager.c:293)
==25063== by 0x3DE40148FB: g_object_constructor (gobject.c:1352)
==25063== by 0x3DE4015D70: g_object_newv (gobject.c:1713)
==25063== by 0x3DE401655F: g_object_new_valist (gobject.c:1830)
==25063== by 0x3DE485924D: g_initable_new_valist (ginitable.c:224)
==25063== by 0x3DE4859348: g_initable_new (ginitable.c:148)
==25063== by 0x5B97330: spice_usb_device_manager_get (usb-device-manager.c:770)
==25063== by 0x52D8C6B: spice_gtk_session_update_keyboard_focus (spice-gtk-session.c:845)
==25063== by 0x52D6DC1: spice_gtk_session_set_property (spice-gtk-session.c:238)
==25063== by 0x3DE40148FB: g_object_constructor (gobject.c:1352)
==25063== 11,959 (72 direct, 11,887 indirect) bytes in 1 blocks are definitely lost in loss record 9,475 of 9,502
==25063== at 0x4A06F18: calloc (vg_replace_malloc.c:566)
==25063== by 0x3459C92DDC: XkbGetKeyboardByName (XKBGetByName.c:59)
==25063== by 0x52DF000: vnc_display_keymap_gdk2xtkbd_table (vncdisplaykeymap.c:153)
==25063== by 0x52D9FA6: spice_display_init (spice-widget.c:389)
==25063== by 0x3DE402FA05: g_type_create_instance (gtype.c:1892)
==25063== by 0x3DE40147A7: g_object_constructor (gobject.c:1849)
==25063== by 0x52DA07B: spice_display_constructor (spice-widget.c:412)
==25063== by 0x3DE4015D70: g_object_newv (gobject.c:1713)
==25063== by 0x3DE401655F: g_object_new_valist (gobject.c:1830)
==25063== by 0x3DE4016893: g_object_new (gobject.c:1545)
==25063== by 0x52DE746: spice_display_new (spice-widget.c:1924)
==25063== by 0x41D6C3: virt_viewer_display_spice_new (virt-viewer-display-spice.c:219)
This was initially public to eventually let a derived class
implement more capabilities. Even though it is technically
doable to derive and tweak exisiting channels, there is a
lack of support in spice-gtk for doing that.
Capability BAR for channel FOO can be disabled at runtime by setting
the SPICE_FOO_CAP_BAR environment variable to '0'
Disabling capabilities is useful for testing purpose.
spice_channel_coroutine returns a void *, but one of its error path
is doing 'return FALSE'. This commit replaces this return with a
'goto cleanup' since this is what is done in the other error paths.
There are several very unlikely failures where no signal is emitted
to indicate the failure. Since applications rely on these signals
to detect spice-gtk connection failures, it's important to emit
one in all error cases.
When trying to start remote-viewer with SPICE over TLS with
--spice-ca-file with a wrong filename, the connection fails
but remote-viewer keeps displaying the "Trying to connect"
message. The only hint that something went wrong is:
(remote-viewer:12924): GSpice-WARNING **: loading ca certs from a/home/teuf/foo.crt
This patch makes sure we emit a SPICE_CHANNEL_ERROR_TLS before
giving up on channel creation to inform the application that
an error happened.
Fix copied from libvirt, commit by Eric Blake.
glibc 2.15 (on Fedora 17) coupled with explicit disabling of
optimization during development dies a painful death:
/usr/include/features.h:314:4: error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
Work around this by only conditionally defining _FORTIFY_SOURCE,
in the case where glibc can actually use it. The trick is using
AH_VERBATIM instead of AC_DEFINE.
The USB device selection applies immediately, so the dialog should be using
'Close' instead of 'OK' for its primary button.
This patch syncs spicy with virt-viewer wrt the USB device selection dialog.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
There is one handler we forgot to disconnect on dispose()
that may cause a crash.
I am thinking of generalizing usage of
spice_g_signal_connect_object()..
Should fix:
https://bugzilla.redhat.com/show_bug.cgi?id=823570
The Windows client was getting in the way of guest copy-paste,
because when the guest was taking the clipboard grab, the agent
notifies the client, it takes the grab too, and in return
receives clipboard notification of new ownership from the client
clipboard.
Though we had a hack to check if this new client clipboard event
is caused by us, the Windows Gtk clipboard is giving 2 notifications
for some reasons.
It turned out there is a much better way than the "selfgrab" hack,
by setting ownership of the clipboard. Problem solved, and cleaner
code!
https://bugzilla.redhat.com/show_bug.cgi?id=822688
The main channel can change when we are reconnecting to the server,
for example, when querying the password to the user. From there,
the old main channel is destroyed, but we don't track properly the
new main channel.
This fix migration crashing later on, because of missing main channel:
https://bugzilla.redhat.com/show_bug.cgi?id=823874
This avoids triggering the grab event on consecutive
matches, such as ctrl+alt (match) then ctrl+alt+foo
(match again) that would prevent the longer combination
from being sent.
If the last key pressed from the grab sequence is a modifier
key, let send it to the guest too.
This solves the issue of default grab-sequence being ctrl+alt
and preventing ctrl+alt+del from working.
The change abc56811de actually added
a field in a public struct while changing overall struct size, the
fields were also reorder, all of this breaks ABI.
However, we are running out of free space in SpiceChannelClass
struct. And since the SPICE_RESERVED_PADDING was 44 bytes, that is
quite limited on 64bits (only 5 pointers fit).
I propose we break ABI during this cycle. This means that programs
using spice-gtk will need to be recompiled to use the new library.
(the old library should be parallel installable though). This let us:
- use a better SPICE_RESERVED_PADDING based on pointer size, since
it is what is usually added for virtual methods
- reset the amount taken from the padding in the various struct
- reorder fields a little
- add some missing "priv" pointers
- whatever I am missing that we can still change before next release
Please comment if I am missing something, or correct me
Related: rhbz#821795
The capabilities have been zeroed after channel reset, which have lead to
publish the wrong caps when both port and tls-port are given, and the
channels are secured (first attempt to connect the channel with "port"
has failed; the channel got reset, and then reconnected with "tls-port"
and bad caps). Specifically, the bug causes semi-seamless migration not
to work when part of the channels are secured.
The spice_audio_new() function is not correctly generated h2def.py
anymore because of the surrounding #ifdef and macros. Add it in
the manual.defs instead.
Avoid API breakage:
2012-05-10 01:56:48,884 (cli:83): Uncaught exception:
Traceback (most recent call last):
File /usr/share/virt-manager/virtManager/console.py, line 475, in
_channel_new_cb
self.audio = spice.Audio(self.spice_session)
TypeError: GObject.__init__() takes exactly 0 arguments (1 given)
https://bugzilla.redhat.com/show_bug.cgi?id=820335
rhbz #815426
When playing a youtube video on Windows guest, the driver sometimes sends
images which contain a video frame, but also other parts of the
screen (e.g., the you tube process bar). In order to prevent glitches, we send these
images as part of the stream, using SPICE_MSG_DISPLAY_STREAM_DATA_SIZED.
The default transfer mode is wrong for spice_display_get_grab_keys.
The array parameter for spice_grab_sequence_new needs explicit
annotation
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
With glib >= 2.31 no debug messages are ever printed out by
default, which makes the --spice-debug flag useless. This
fix explicitly turns on the appropriate log domain when
debug is requested. It takes care to preserve the users
own existing log domain requests