Commit Graph

906 Commits

Author SHA1 Message Date
Marc-André Lureau
ff7994ca59 Clear cache and glz dictionnary on switch-host
If we don't clear the glz dictionnary, this might lead to
corrupted/invalid dictionnary and invalid memory allocation due
unbounded increase of dictionnary size
2012-04-16 20:01:46 +02:00
Marc-André Lureau
1ee71103c5 Set new cert-subject when switching host
https://bugzilla.redhat.com/show_bug.cgi?id=802574
2012-04-16 20:01:45 +02:00
Marc-André Lureau
6883155ab4 gtk: scroll event are not received with recent gtk+
Add explicit scroll event mask to make it work again.
2012-04-16 20:01:41 +02:00
Marc-André Lureau
9e1273fe1f Fix cursor hide not hiding in some cases
cursor_set() didn't un-hide correctly by setting "show_cursor" to
NULL.

The code is simplified a bit in server mode case, where the new cursor
will be invalidated and shown during cursor move only, instead of
twice (checked no regression with dual-head server mode)
2012-04-10 13:20:50 +02:00
Marc-André Lureau
452c42cb1e Fix crash when closing while recording
First notify about disconnection before resetting the channel data.
An audio recording task might expect the channel to be in a ready
state otherwise, for example.

https://bugzilla.redhat.com/show_bug.cgi?id=810247
2012-04-06 04:05:14 +02:00
Marc-André Lureau
3df239ec69 agent: avoid use of alloca for sending large msg
Instead of allocating unbounded memory and doing extra copy on the
stack, let's just improve our helper function to send messages in
various pieces.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=809145
2012-04-05 16:48:09 +02:00
Christophe Fergeau
23f4cc040f autogen.sh: default to --enable-vala when building from git
People using autogen.sh are likely to be building from git, so may
get updates to vala files at any time. Checking for the presence of
controller.vala.stamp to decide whether vala should be enabled or not
is not very accurate since it doesn't reflect if a .vala file needs
to be regenerated or not.
It's better to always pass --enable-vala to configure, it's always
possible to disable it by using --disable-vala as an autogen.sh argument.
2012-04-04 10:29:04 +02:00
Christophe Fergeau
2eaa3cf7ad controller: handle USB redirection messages 2012-04-04 10:22:00 +02:00
Christophe Fergeau
79436bcd0d autogen.sh: log configure command line
Since --enable-vala may or may not be passed to configure, seeing
the actual command line that was used is helpful.
2012-04-04 10:21:59 +02:00
Marc-André Lureau
bda31fdf08 fix build with glib < 2.32
Reported and verified by Nicolas Prochazka
2012-04-03 14:14:10 +02:00
Hans de Goede
215065514c SpiceDisplay: Fix rounding of mouse motion events with GTK-3.0
Before this patch we were assuming that the GdkEventMotion value we receive
are always whole (integer) numbers, which is not the case with GTK-3.0.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-04-03 09:22:41 +02:00
Hans de Goede
5d773be6eb SpiceDisplay: Don't try to scale mouse coordinates when we're not scaling
Often (when not resized by the user) even though scaling is enabled, we are
not actually scaling. In this case it is not necessary to scale the
mouse coordinates, and sometimes it is even harmful.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-04-03 09:22:41 +02:00
Yonit Halperin
84d29d0c0f controller: add support for DISABLE_EFFECTS and COLOR_DEPTH
rhbz #787449

Signed-off-by: Yonit Halperin <yhalperi@redhat.com>
2012-04-03 08:53:55 +03:00
Marc-André Lureau
b9f7081458 Handle grab-broken event
This fixes the pointer being "trapped" in the center of the screen in
server-side mouse mode. It also correctly inform the client that the
pointer/keyboard is no longer grabbed so it can adjust its UI state
accordingly (remote the "press ctrl+alt to ungrab" messages etc).

I can reproduce only with RHEVM22 host, and a RHEL6 guest, when
switching consoles.
2012-03-31 02:07:44 +02:00
Marc-André Lureau
d16df7dab0 widget: fix invalid memory ref after channel is distroyed
When the display channel is destroyed, we disconnect all signals
handlers, but we don't remove the reference on the primary surface
data, and that can lead to crashes in a later expose event, reusing
the canvas surface (ex, if scaling is disabled). Call
primary_destroy() when disconnecting the channel from the widget.

We now keep the primary surface during channel reset (right after
disconnect for example), so the primary surface can be eventually
recycled, and the widget still holds a valid reference until the
signal is received. The primary surface is ultimately destroyed during
finalize, or if the new primary surface size doesn't match.

Program received signal SIGSEGV, Segmentation fault.
__memmove_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2130
2130		lddqu	-68(%rsi), %xmm0
Missing separate debuginfos, use: debuginfo-install gtk2-engines-2.20.2-2.fc15.x86_64 libusb1-1.0.9-0.3.rc1.fc16.x86_64 p11-kit-0.6-1.fc16.x86_64
(gdb) bt
    at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2130
    srclen=<optimized out>, srcinc=4096, destinc=68, height=<optimized out>,
    half_order=0) at /usr/include/bits/string3.h:52
    dest_bits_per_pixel=32, req_yoffset=<optimized out>, req_xoffset=0,
    image=0x7fffffffb9a0, req=<optimized out>, dpy=0x64a630) at PutImage.c:821
    req_height=<optimized out>, req_width=<optimized out>, y=<optimized out>,
    x=0, req_yoffset=<optimized out>, req_xoffset=0, image=0x7fffffffb9a0,
    gc=0xa817e0, d=33554452, dpy=0x64a630) at PutImage.c:870
    req_xoffset=0, req_yoffset=<optimized out>, x=0, y=26, req_width=17,
    req_height=20, dest_bits_per_pixel=32, dest_scanline_pad=32)
    at PutImage.c:908
    image=0x7fffffffb9a0, req_xoffset=0, req_yoffset=0, x=0, y=26,
    req_width=17, req_height=20) at PutImage.c:1027
    image=<optimized out>, src_x=0, src_y=0, width=17, height=20, dst_x=0,
    dst_y=26) at cairo-xlib-surface.c:1357
---Type <return> to continue, or q <return> to quit---c
    height=20, width=17, dst_y=26, dst_x=0, src_y=<optimized out>,
    src_x=<optimized out>, pattern=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER,
    surface=0xb9a650) at cairo-xlib-surface.c:2403
    dst_y=26, dst_x=0, mask_y=0, mask_x=0, src_y=26, src_x=0,
    abstract_dst=0xb9a650, mask_pattern=0x0, src_pattern=0x7fffffffc6b0,
    op=CAIRO_OPERATOR_OVER) at cairo-xlib-surface.c:2452
    src_pattern=0x7fffffffc6b0, mask_pattern=0x0, abstract_dst=0xb9a650,
    src_x=0, src_y=26, mask_x=0, mask_y=0, dst_x=0, dst_y=26, width=17,
    height=20, clip_region=0x0) at cairo-xlib-surface.c:2415
    src=0x7fffffffc6b0, mask=0x0, dst=0xb9a650, src_x=0, src_y=26, mask_x=0,
    mask_y=0, dst_x=0, dst_y=26, width=17, height=20, clip_region=0x0)
    at cairo-surface.c:1802
    traps=0x7fffffffbee0, src=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER,
    dst=0xb9a650) at cairo-surface-fallback.c:762
    op=CAIRO_OPERATOR_OVER, dst=0xb9a650, traps=0x7fffffffbee0,
    antialias=CAIRO_ANTIALIAS_DEFAULT, clip=0x0, extents=0x7fffffffc600)
    at cairo-surface-fallback.c:812
---Type <return> to continue, or q <return> to quit---bt
    op=CAIRO_OPERATOR_OVER, source=0x7fffffffc6b0, clip=0x0)
    at cairo-surface-fallback.c:935
    source=0x7fffffffc6b0, op=CAIRO_OPERATOR_OVER, surface=0xb9a650)
    at cairo-surface.c:2027
    source=0x7fffffffc6b0, clip=0x7fffffffc7b0) at cairo-surface.c:1993
    at cairo-gstate.c:1049
    at spice-widget-cairo.c:104
    expose=0x7fffffffceb0) at spice-widget-cairo.c:133
    expose=0x7fffffffceb0) at spice-widget.c:885
    return_value=0x7fffffffca60, n_param_values=<optimized out>,
    param_values=0x7fffffffcad0, invocation_hint=<optimized out>,
    marshal_data=<optimized out>) at gtkmarshalers.c:86
    return_value=0x7fffffffca60, n_param_values=2,
    param_values=0x7fffffffcad0, invocation_hint=<optimized out>)
---Type <return> to continue, or q <return> to quit---c
    at gclosure.c:777
    detail=0, instance=<optimized out>, emission_return=0x7fffffffccb0,
    instance_and_params=0x7fffffffcad0) at gsignal.c:3584
    signal_id=<optimized out>, detail=0, var_args=<optimized out>)
    at gsignal.c:3305
    signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3351
    event=0x7fffffffceb0) at gtkwidget.c:4999
2012-03-31 02:02:51 +02:00
Marc-André Lureau
d19e1b0f21 mjpeg: fix blue-tinted video stream with old server
The major == 1 uses RGB colorspace for mjpeg streams.
2012-03-31 02:02:51 +02:00
Marc-André Lureau
9f7c12da84 session: take pubkey reference in setter
The session assumed it owned a reference to it.
But it didn't get it, and that lead to invalid memory access.

Fixes:  https://bugzilla.redhat.com/show_bug.cgi?id=802574
2012-03-30 14:21:55 +02:00
Marc-André Lureau
23224b116e Be more tolerant on NULL arrays
2 places where we should be more carreful with NULL arrays, and we can
avoid potential crashes.
2012-03-30 14:21:38 +02:00
Hans de Goede
3a424e64d5 usb-device-widget: Call set_active on the toggle_button, not the alignment
Since the gnome HIG-ifying of usb-device-widget.c, the vbox contains
alignments, which in turn contain a toggle_button, so calling
gtk_toggle_button_set_active directly on the vbox-containers childdren is
wrong.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-29 17:25:17 +02:00
Uri Lublin
20da7a6d81 usb-acl-helper: add a missing "break" 2012-03-29 15:16:52 +02:00
Marc-André Lureau
05a203af12 build-sys: move codegen & proto to spice-common
With this iteration, all the spice_codegen.py/proto/marshaller
generation has been moved to spice-common.

The spice-common directory will ship spice-protocol, since it's needed
there too to build libspice-common.

Again, make distcheck passes. Build with mingw & fedora linux.
2012-03-25 19:22:52 +02:00
Marc-André Lureau
6db275a422 Always release shm of primary surfaces
Always remove shared memory segment of primary surfaces when
destroying its canvas.
2012-03-22 14:23:09 +01:00
Marc-André Lureau
3ff7d1f696 controllers: signal when a client is connected 2012-03-21 23:06:41 +01:00
Marc-André Lureau
f1a65e78c8 controller: handle SEND_CAD message as a property 2012-03-21 23:05:43 +01:00
Marc-André Lureau
86e57864b2 Fix cursor not being shown in client mode in some cases
The following seems to happen:
- cursor-hide (for all cursor/display channels)
- cursor-set (for all cursor/display channels)

All cursor/display channels receive cursor-set events when the cursor
is changed, however, only current display cursor should be drawn in
server-mode. How to know which display?

So it will wait until cursor-move to draw it in server-mode on the
right display.

In the case of client-mode cursor, it doesn't matter since it will
depend on which client display the pointer is, so it can be changed
immediately.
2012-03-21 20:02:43 +01:00
Marc-André Lureau
856ce17aa5 build-sys: fix make distclean going twice in vapi dir
Don't use DIST_SUBDIRS, it's not needed anyway.
2012-03-20 18:36:35 +01:00
Marc-André Lureau
ca6066d952 build-sys: fix compilation of bindings
Hide symbol from API to fix pygobject.

Also vapigen chokes on "record" typename

SpiceClientGtk-3.0.gir:32.55-32.55: error: The type name `Gtk.BoxClass' could not be found <type name="Gtk.BoxClass" c:type="GtkBoxClass"/>

This seems to be a bug in symbol lookup in vapigen. Using a struct
typedef solves it.
2012-03-20 18:28:41 +01:00
Marc-André Lureau
b9b658f6ea doc: gtk-doc cleanup
Fix all the unused symbols and a few warnings (a lot left)
2012-03-20 02:15:21 +01:00
Marc-André Lureau
126794d301 Add SPICE_DISABLE_DEPRECATED guard 2012-03-20 00:52:38 +01:00
Marc-André Lureau
51d4173293 build-sys: improve maintainer clean 2012-03-20 00:20:45 +01:00
Marc-André Lureau
5b67c33c11 build-sys: use new git.mk 2012-03-20 00:20:45 +01:00
Marc-André Lureau
13f5ebbf07 Hide cursor when it is on a different screen in server mode
When the cursor shape is changed, all the cursor channels are
updated. The current code assumed that the "set" of the shape should
show the cursor, but it should stay hidden instead.

Also, when the cursor is hidden, we must invalidate its current
region to redraw display.

Fix: https://bugzilla.redhat.com/show_bug.cgi?id=804308
2012-03-19 20:04:01 +01:00
Marc-André Lureau
82a4703fea Do not grab display widget
We used to gtk_grab_add() after mouse grab to limit the mouse events
to the display. But it isn't necessary if the display has its own
window, since gdk_pointer_grab() will be limited to it.

Note the widget has the keyboard focus & is focused, so this doesn't
affect keyboard events.

However, this allows application to keep global accelerators
functionning if they want to (like virt-viewer with custom key
bindings).
2012-03-18 18:38:53 +01:00
Marc-André Lureau
a01677289c Notify agent-connected property change 2012-03-18 17:04:53 +01:00
Marc-André Lureau
b0706c6d83 Improve spice_main_set_display_enabled()
Check given display id is within the range of array.
Allows to be call with -1 to turn set all displays.
2012-03-18 17:04:53 +01:00
Marc-André Lureau
0e0d3a4303 Fix non-semi-seamless migration in spicy
The windows are destroyed during non-semi-seamless migrations, but the
gtk session and connected handlers remains. When a property changes
again on it, it will signal a destroyed window and lead to a crash.

The signal handler should be disconnected when the window is
destroyed. Since we have N numbers of handlers, it's easier to use
spice_signal_connect_object() helper to handle this for us by turning
spice_window structure into a basic GObject.

That GObject code could be improved, but that wasn't the goal of this
patch.
2012-03-18 17:04:53 +01:00
Marc-André Lureau
31248276ff Use given color depth in monitor configuration
The main channel only relied on
VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH to set color depth when
connecting to a guest. However, that doesn't seem to be
enough. Instead send given color depth with monitor configuration.

Fix --spice-color-depth option not "apparently" working.
2012-03-18 17:04:53 +01:00
Marc-André Lureau
0c11bfc9d5 build-sys: if stow is installed, default prefix to it
This is going to make life easier for stow users, including myself.
2012-03-16 17:15:03 +01:00
Marc-André Lureau
837b98d043 build: fix build with glib < 2.32
Using GMutex as a static mutex is only possible since 2.32.
2012-03-16 17:15:03 +01:00
Marc-André Lureau
e8c91f874a Add a G_GNUC_NORETURN to a function that exits 2012-03-16 01:44:28 +01:00
Marc-André Lureau
df1a1e35f8 use common submodule 2012-03-15 12:46:25 +01:00
Marc-André Lureau
8394a9b387 Fix incorrect array size check 2012-03-15 02:18:08 +01:00
Marc-André Lureau
e313b7f249 Move undef FORTIFY below config.h
It used to be below, then was moved on top of all, but now it's
defined in config.h. Hopefully below config.h is the right
place. config.h should never have direct includes anyway.
2012-03-14 20:43:07 +01:00
Hans de Goede
8778bf016d buildsys: Disable some warnings
Mostly so that they don't turn into errors when building from source:
-Wno-missing-field-initializers:
Because this has to be close to the most stupid warning gcc has ever produced
-Wno-deprecated-declarations
Because we use some deprecated functions to avoid #ifdef hell while maintaining
compat with older gtk / glib versions

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-14 15:22:48 +01:00
Hans de Goede
434adeb05b usbredir: Check for existing usb channels after libusb init
Currently trying to view a usbredir enabled vm from virt-manager causes
virt-manager to crash. This crash is caused by the following happening:

-virt-manager sets up the session, including connecting all the channels
-a spice-gtk internal code path calls spice_usb_device_manager_get()
-spice_usb_device_manager_get calls channel_new on all already connected
 usb channels
-channel_new does:
 spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel),
                                    self->priv->context);
-But self->priv->context has not been set yet (so is NULL) -> segfault!

This patch fixes this by moving the iterating over already connected
usb channels to after the setting of self->priv->context. Note this means
that the channels will no longer get checked when there is no USB_REDIR
support. That is not a problem since spice_usb_device_manager_initable_init
will return FALSE in that case anyways.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-14 15:01:59 +01:00
Marc-André Lureau
a8a11db952 Use GTK_DISABLE_DEPRECATED to avoid inclusion of problematic headers
/usr/i686-w64-mingw32/sys-root/mingw/include/gtk-2.0/gtk/gtkitemfactory.h:47:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
2012-03-14 13:28:25 +01:00
Marc-André Lureau
70be076027 Fix 'libintl_printf' is an unrecognized format function
../common/lz.h:18:5: error: 'libintl_printf' is an unrecognized format function type [-Werror=format]
2012-03-14 13:28:25 +01:00
Marc-André Lureau
8bd1299551 Remove deprecation warnings 2012-03-14 13:27:46 +01:00
Daniel P. Berrange
04e8187a81 Disable -Wwrite-strings for Python binding
The code generator for the python binding generates code which
throws away const-ness on strings. Disable the -Wwrite-strings
warning to avoid failing on this auto-generated code.
2012-03-14 12:25:47 +00:00
Daniel P. Berrange
69406f7330 Replace %02hhx with %02x in UUID format
Use of 'hh' in the UUID format string is not required. Furthermore
it causes errors on Mingw32, where the 'hh' modifier is not supported
2012-03-13 18:10:23 +00:00