Commit Graph

1010 Commits

Author SHA1 Message Date
Marc-André Lureau
be8ff99571 Implement simple monitors alignment 2012-07-16 17:46:41 +02:00
Marc-André Lureau
547597a687 widget: use display monitors configuration
Use display::monitors property to manage display area. Call
update_area_monitor() to update the widget area depending on monitor
configuration
2012-07-16 17:46:41 +02:00
Marc-André Lureau
98287e5813 spicy: disable display when deleting window 2012-07-16 17:46:41 +02:00
Marc-André Lureau
569b15e161 spicy: learn to deal with monitors 2012-07-16 17:46:41 +02:00
Marc-André Lureau
0b0ec738a9 Make-up a MonitorConfig if the server doesn't provide one
This allows easier compatibility for clients that don't have to
check and interact differently depending on channel capabilities.
2012-07-16 17:46:41 +02:00
Marc-André Lureau
6106d1aaa4 Handle SPICE_MSG_DISPLAY_MONITORS_CONFIG 2012-07-16 17:46:41 +02:00
Marc-André Lureau
8ee2675649 Don't attempt to draw an invalid area
If we don't intersect, the area is invalid or of size 0.
2012-07-16 17:46:41 +02:00
Marc-André Lureau
b79f3e148b Use monitor_id to compute display_id 2012-07-16 17:46:41 +02:00
Marc-André Lureau
b1aaa08be7 Document spice_main_send_monitor_config() 2012-07-16 17:46:41 +02:00
Marc-André Lureau
8aacc276c5 widget: don't forget to disconnect all signals handlers
We forgot about display-mark. Use spice_g_signal_connect_object()
helper, which will disconnect properly in all circunstances.
2012-07-16 17:46:41 +02:00
Marc-André Lureau
69df4d4133 spice_channel_connect() success if state >= CONNECTING
We may have several widget trying to re-connect the channels now.
It is fine to return successfully if we are already connecting or
connected.
2012-07-16 17:46:41 +02:00
Marc-André Lureau
66deab923d widget: add monitor property with ctor 2012-07-16 17:46:41 +02:00
Marc-André Lureau
230125032d Claim SPICE_DISPLAY_CAP_MONITORS_CONFIG 2012-07-16 17:46:41 +02:00
Marc-André Lureau
9381bc293c Add spice_display_get_primary() 2012-07-16 17:46:40 +02:00
Marc-André Lureau
d2e6f651da display: add readonly monitors property 2012-07-16 17:46:40 +02:00
Marc-André Lureau
d809b2ce54 glib-compat: add g_clear_pointer
A helpful macro from glib 2.34
2012-07-16 17:46:40 +02:00
Marc-André Lureau
6bea13927e Change surface_id to a guint32
That's the correct type used by the protocol.
2012-07-16 17:46:40 +02:00
Marc-André Lureau
ac9e55b64f widget: add main channel before other channels
Make sure that the d->main channel member can be referenced when
adding further channels, when we perform their setup.
2012-07-16 17:46:40 +02:00
Marc-André Lureau
53127e3056 Add missing agent cap description 2012-07-16 17:46:40 +02:00
Marc-André Lureau
e3bb7b1cfd display: learn to restrict display to an area
Each spice widget can now restrict the area of the primary
surface they show and interact with by setting the private
area member.

A nice clean-up would be to seperate an area object that
would deal with clipping, input translation and color
conversion, but the resulting code would be similar anyway
2012-07-16 17:46:40 +02:00
Marc-André Lureau
59b7c8a005 widget: simplify redraw call 2012-07-16 17:46:40 +02:00
Marc-André Lureau
175f80a876 Update spice-common 2012-07-16 17:46:37 +02:00
Uri Lublin
f054f70270 usb-device-manager: mingw: connect: cleanup device if it's libdev is missing
For Windows client, when connecting a device to the guest, if a libusb
device (libdev) does not exist, cleanup and forget about that device.

Most likely, the device was plugged out at driver installation
time, and its remove-device event was ignored.
2012-07-16 10:25:06 +03:00
Yonit Halperin
9414fccffe migration/channel-inputs: reset motion count after migration
The motion count must stay synchronized with the server, otherwise,
it is possible that we will stop sending motion events to the server
after migration.

rhbz#835997
2012-07-12 14:54:25 +03:00
Uri Lublin
ac5a5b2c6a usb-device-manager: do not try to connect a usb device that was removed
If a device that is asked to be shared with the guest, is unplugged out
of the machine before being redirected, then let the user know that
usbredir of that device failed (and cleanup nicely).

For Windows client, the time between request and redir is larger, as
it includes the time it takes to install the libusb driver.
2012-07-11 17:41:09 +03:00
Marc-André Lureau
f16520755d usbutil: be more explicit about usbids_vendor_count usage
I introduced a regression in the previous patch, counting the
usbids_vendor_count from -1 if the previous attempt failed.
2012-07-11 16:29:34 +02:00
Marc-André Lureau
748b42ecc4 usbutil: fix crash on windows
vendor_count is the last access index, the actually count is +1.

On Windows, it crashes later on because of corrupted memory.

Thanks to valgrind for this precious help:

==4535== Invalid write of size 2
==4535==    at 0x40197E: spice_usbutil_parse_usbids (usbutil.c:170)
==4535==    by 0x401CEC: spice_usbutil_load_usbids (usbutil.c:241)
==4535==    by 0x4020C6: main (usbutil.c:322)
==4535==  Address 0x56b740c is 12 bytes after a block of size 348,160 alloc'd
==4535==    at 0x4A0884D: malloc (vg_replace_malloc.c:263)
==4535==    by 0x4EAAEBE: g_malloc (gmem.c:159)
==4535==    by 0x401847: spice_usbutil_parse_usbids (usbutil.c:156)
==4535==    by 0x401CEC: spice_usbutil_load_usbids (usbutil.c:241)
==4535==    by 0x4020C6: main (usbutil.c:322)
==4535==
2012-07-11 14:44:33 +02:00
Marc-André Lureau
2a54f19a64 usbutil: look up usb.ids under g_get_system_data_dirs() by default
Simplify a little bit the portability by looking up usb.ids file
under g_get_system_data_dirs(). This is how most resources are
found under other OS, looking up files under various places, since
installation location may vary.
2012-07-11 13:43:59 +02:00
Marc-André Lureau
b569d6ff7a build: fix make distcheck 2012-07-10 20:53:53 +02:00
Uri Lublin
12b348a163 usb-device-manager: mingw: win driver install callback: add missing ifdef
This fixes the following compilation error message (without USE_USBREDIR):

usb-device-manager.c:183:13: error: 'spice_usb_device_manager_drv_install_cb' declared 'static' but never defined [-Werror=unused-function]
2012-07-10 19:26:46 +03:00
Uri Lublin
59f31ce502 win-usb-driver-install: initialize "req" with memset
This fixes the following compilation error message:

../../gtk/win-usb-driver-install.c: In function 'spice_win_usb_driver_send_request':
../../gtk/win-usb-driver-install.c:187:5: error: missing braces around initializer [-Werror=missing-braces]
../../gtk/win-usb-driver-install.c:187:5: error: (near initialization for 'req.hdr') [-Werror=missing-braces]
2012-07-10 19:26:29 +03:00
Uri Lublin
00cbbf53af usb-device-manager: mingw: ignore "remove" udev event when un/installing a driver 2012-07-10 17:09:00 +03:00
Uri Lublin
62e9488868 usb-device-manager: mingw: keep driver install/uninstall state of a device
Currently only driver install/unsinstall is of interest, such that
extra udev events can be ignored.
2012-07-10 17:09:00 +03:00
Uri Lublin
fb6eb40ab4 usb-device-manager: add 'state' field to SpiceUsbDeviceInfo
To be used on Win32 to ignore extra udev events
received during driver install/uninstall.
2012-07-10 17:09:00 +03:00
Uri Lublin
e26f4bffa4 Win32/mingw: win-usb-dev: skip hubs
also skip devices with bad (0) device-address.
2012-07-10 17:09:00 +03:00
Uri Lublin
6b806a6e1e Win32/mingw: usb-device-manager: uninstall win usb driver upon device disconnect 2012-07-10 17:09:00 +03:00
Uri Lublin
147c0d1bb2 win-usb-driver-install: add capability to remove (uninstall) a win usb driver 2012-07-10 17:09:00 +03:00
Uri Lublin
714def3df0 Windows mingw: usb: Dynamically install a libusb driver for USB devices
- Added win-usb-driver-install.[ch]
- Added win-usb-clerk.h

Operation (on Windows, spice-gtk point of view):
- After some sanity checks, just before redir'ing a USB device
  a libusb driver needs to be installed (before libusb can open the device)
- A connection (NamedPipe) is established with usb-clerk, a libusb
  driver installation service, and a request for driver installation
  is sent.
- Installation status is asynchronously read from the pipe, and
  spice_usb_drv_install_finished() is called.
- Upon a successful intallation, usbredir continues.

Linux operation is not changed.
2012-07-10 17:09:00 +03:00
Arnon Gilboa
5525ce9734 Windows mingw: usb: implement GUdevDevice & GUdevClient for windows
- Added win-usb-dev.[ch]
- Added GUdevDevice and GUdevClient like classes
- Added uevent signal based on WM_DEVICECHANGE
2012-07-10 17:08:59 +03:00
Uri Lublin
cb68b670bb Make SpiceUsbDevice a box for SpiceUsbDeviceInfo, instead of a box for libusb_device
Note that this change may affect performance a bit, as sometimes there is
a need to find the libusb_device or the SpiceUsbDevice. Likely it's negligible.
2012-07-10 17:08:59 +03:00
Uri Lublin
4c1202f994 Introduce SpiceUsbDeviceInfo to be kept instead of a libusb_device
For Windows, it's better not to keep references for libusb_devices
that are not used.
So instead of makeing SpiceUsbDevice a box for a libusb_device
it is going to be a box for a SpiceUsbDeviceInfo.
2012-07-10 17:08:59 +03:00
Uri Lublin
42216eb7de Windows mingw: usb: configure.ac: do not require GUDEV for USBREDIR
For windows GUDEV is not required
For Linux GUDEV is checked as a part of USBREDIR block, but
as a separate check.
2012-07-10 17:08:59 +03:00
Uri Lublin
f871ed2176 usb-device-manager: mingw: add_dev: ignore already known devices
Sometimes on a Windows client, udev events are received while
the driver is being un/installed. so just ignore it
2012-07-10 17:08:59 +03:00
Uri Lublin
235e878181 usb-device-manager: add a helper function to find a usb device <bus, addr>
And use it in spice_usb_device_manager_remove_dev
2012-07-10 17:08:59 +03:00
Uri Lublin
0ba45213b0 spice_usb_device_get_description: use device-descriptor only to get <vid,pid>
In preparation for a different SpiceUsbDevice.

With the new SpiceUsbDeviceInfo, <vid,pid> will be provided by
SpiceUsbDevice, and not by the device_descriptor (from libusb)
2012-07-10 17:08:59 +03:00
Uri Lublin
15b4e7890f spice_usb_device_manager_device_error: replace SpiceUsbDevice with libusb_device
Its only user is channel-usbredir, which needs the libusb_device.

In preparations for a different SpiceUsbDevice.
2012-07-10 17:08:59 +03:00
Uri Lublin
c1799ead7e spice_usb_device_manager_auto_connect_cb: use type SpiceUsbDevice for "device"
Currently SpiceUsbDevice is a BOX for libusb_device.
In preparation for a different SpiceUsbDevice.
2012-07-10 17:08:59 +03:00
Uri Lublin
97740e38e6 spice_usb_device_manager_add_dev: use type SpiceUsbDevice for "device"
Currently SpiceUsbDevice is a BOX for libusb_device.
In preparation for a different SpiceUsbDevice.

Renamed the libusb_device variable to libdev. Needed when
asking usbredir to check the filter.
2012-07-10 17:08:59 +03:00
Uri Lublin
a0ec25a170 spice_usb_device_manager_add_dev: check auto_ok before freeing libusb device list
In preparation for a different SpiceUsbDevice.
2012-07-10 17:08:59 +03:00
Uri Lublin
2339c0005c spice_usb_device_manager_remove_dev: use type SpiceUsbDevice for "device"
Currently SpiceUsbDevice is a BOX for libusb_device.
In preparation for a different SpiceUsbDevice.
2012-07-10 17:08:59 +03:00