Commit Graph

36 Commits

Author SHA1 Message Date
Hans de Goede
607d58f4eb client: Do not try to send display_config until we've received the agent caps
Currenty, we check the agent caps in RedClient::handle_agent_connected
for VD_AGENT_CAP_DISPLAY_CONFIG and if present send display_config, but at
this time we have not received the caps yet, so remove this.

Also the send_agent_display_config call in on_agent_announce_capabilities
lacks a check for _agent_disp_config_sent, and we send the display config
before announcing that we may do so by sending our own caps, which seems
inpolite.
2010-10-18 10:40:51 +02:00
Hans de Goede
3a4051d7ce spicec: Do not try to do accounting of pci memory
Without this patch spicec reproducely hangs in
GlzDecoderWindow::pre_decode_update_window().

When GlzDecoderWindow::will_overflow() returns true,
GlzDecoderWindow::pre_decode_update_window(),
waits for a call to GlzDecoderWindow::post_decode()
to free up some memory

This happens even though there still is pci memory
available (otherwise the driver would not have
been able to send an image to decode in the first
place).

The GlzDecoderWindow::post_decode() call never happens
as the server is waiting for a reply to the decode
of the hanging image, causing the client to hang
for ever.

This patch fixes this by simply removing the
"attempted" pci memory accounting. As there is no
need for that, as the driver already must keep
track of pci memory usage.

I've verified that both the old and new Xorg drivers
take care of not overusing the pci memory themselves
I would expect the same to be true for the windows
driver.

Note the calculating of the glz_window_size in
red_client.cpp cannot be removed as the calculated
value is send as part of the SpiceMsgcDisplayInit on
connect.
2010-10-09 22:27:53 +02:00
Hans de Goede
1e34c14c64 spicec: only send display-config if the agent can handle it 2010-10-06 20:13:01 +02:00
Hans de Goede
9b00e93efb spicec: don't send agent messages directly from ClipboardListener callbacks
ClipboardListener callbacks can run from another thread then the
main channel loop thread, where agent messages are normally dispatched from.

So they may not send agent messages directly, instead they should post
events to the main channel loop.
2010-10-06 19:17:08 +02:00
Hans de Goede
7b84db7a74 spicec: Move setting of clipboard_owner to guest to platform code
Atleast under x11 there is a race condition when setting the clipboard
owner to guest from the RedClient code rather then doing it in Platform.

After the XSetSelectionOwner() in Platform::on_clipboard_grab(), which runs
from the main message loop thread, the x11 event thread can receive a
SelectionRequest event from another x11 app, before the RedClient code
has set the clipboard owner, which will trigger the owner != guest
check in the SelectionRequest event handling code.

By moving the setting of the owner in to Platform::on_clipboard_grab() it
gets protected by the clipboard lock, which closes this tiny race.
2010-10-06 19:17:08 +02:00
Hans de Goede
aabca2864d spicec-x11: Force processing of ownerchange event when releasing the cb
Make sure we process the XFixesSetSelectionOwnerNotify event caused by
us setting the clipboard owner to none, directly after setting the owner
to none. Otherwise we may end up changing the clipboard owner to none, after
it has already been re-owned because the XFixesSetSelectionOwnerNotify event
to owner none is event is still pending when we set the new owner, and
then changes the owner back to none once processed messing up our clipboard
ownership state tracking.

I saw this happening when doing copy twice in succession inside the guest.
2010-10-04 11:49:14 +02:00
Hans de Goede
8a160078d0 Keep track of clipboard ownership
Given that all clipboard handling is async, it is possible to for
example receive a request for clipboard data from the agent
while the client no longer owns the clipboard (ie a
VD_AGENT_CLIPBOARD_RELEASE message is in transit to the agent).

Thus it is necessary to keep track of our notion of clipboard ownership
and check received clipboard messages (both from other apps on the client
machine and from the agent) to see if they match our notion and if not
drop, or in case were a counter message is expected nack the clipboard
message.
2010-10-02 16:29:36 +02:00
Hans de Goede
deb849dfd5 Rename platform clipboard handling functions
Rename the 4 platform clipboard functions which get called
upon receival of an agent clipboard message to on_clipboard_*

The old set_clipboard_* names were confusing as they suggest being
a class property setter (like set_event_listener) rather then
event handler, and set_clipboard_owner was causing a name conflict
with the next patch in this series.
2010-10-02 15:32:48 +02:00
Hans de Goede
5781c97a17 Move checking for on demand clipboard cap closer to sending of agent messages
This way the events will always get generated and other things
(such as clipboard ownership administration, see the next patches)
can be done in repsonse to the events, even though no message will be send.

This patch also removes the !_agent_caps check from the capability
checks, this is not needed as VD_AGENT_HAS_CAPABILITY checks _agent_caps_size
which will be 0 when _agent_caps is NULL.
2010-10-02 15:32:28 +02:00
Hans de Goede
bc9f00961f Respond to clipb request with an unsupported type with data with a none type
Currently we send a VD_AGENT_CLIPBOARD_RELEASE when we receive a
VD_AGENT_CLIPBOARD_REQUEST with a type which we do not support. This is not
correct, as this means given up clipboard ownership while we may be able
to answer requests with different types. The correct response is to
nack the request by sending a VD_AGENT_CLIPBOARD (data) message with a type
of VD_AGENT_CLIPBOARD_NONE.
2010-10-01 20:14:16 +02:00
Hans de Goede
a2d645ffe3 Change VD_AGENT_CLIPBOARD_GRAB to an array of types
A clipboard owner can indicate that it can supply the data the clipboard
owns in multiple formats, so make the data passed with a
VD_AGENT_CLIPBOARD_GRAB message an array of types rather then a single
type.
2010-10-01 20:01:47 +02:00
Arnon Gilboa
c909198eca client: support clipboard/selection-owner model (v2)
-includes most of Hans' review fixes (up to the SelectionRequest comment [4]) & X11 wips sent by Hans (10x!)
-use the VD_AGENT_CLIPBOARD_* types in the platform code
-add ifs for VD_AGENT_CAP_CLIPBOARD_BY_DEMAND in both sides
-support the GRAB/REQUEST/DATA/RELEASE verbs in both ways
-pasting clipboard data is now "only-by-demand" from both sides (client and agent), whose behavior is symmetric
-client and agent don't read or send the contents of the clipboard unnecessarily (e.g. copy, internal paste, repeating paste, focus change)
-set client as clipboard listener instead of application
-add atexit(cleanup) in win platform

linux:
-instead of clipboard atom selection instead of XA_PRIMARY
-enable USE_XRANDR_1_2 and support clipboard in MultyMonScreen
-send utf8 with no null termination, remove ++size
-add xfixes in configure.ac & Makefile.am

windows:
-bonus: support image cut & paste, currently only on windows

not done yet:
-clipboards formats are still uint32_t, not mime types stores as strings
-platform_win is still used, not the root window
-not replaced the ugly windows CF_DIB in agent/winclient
2010-10-01 16:06:10 +02:00
Alon Levy
c47def6e48 client: add default agent capabilities 2010-08-31 14:30:00 +03:00
Alon Levy
18466b8b55 client: add announce_capabilities 2010-08-31 11:08:09 +03:00
Yonit Halperin
7b7feaecdf client: Fix for clipboard sending; It wasn't thread safe. 2010-08-23 08:19:26 +03:00
Alexander Larsson
12b08f2c3e codegen: Various cleanups
Remove all uses of @end in the marshaller, instead just using
the C struct array-at-end-of-struct. To make this work we also remove
all use of @end for switches (making them C unions).

We drop the zero member of the notify message so that we can avoid this
use of @end for a primitive in the marshaller (plus its useless to send
over the wire).

We change the offsets and stuff in the migration messages to real pointers.
2010-07-19 16:28:22 +02:00
Arnon Gilboa
ce03f5449d client: add clipboard support
* windows - untested
 * linux - small strings both ways, large implemented differently:
  * client to guest - support INCR
  * guest to client - we supply a single possibly very large property
 * requires server changes in next patch to work with spice-vmc
2010-07-19 10:30:19 +03:00
Yonit Halperin
9877e7ae84 client: command line arguments for setting windows guest monitors'
color depth and disabling some display options (helpful on WAN)
2010-07-19 09:40:11 +03:00
Alexander Larsson
eb3fe11d94 Fix version mismatch error on connect
Protocol is 0 (auto), 1 (old), or 2 (new). This is (apart from 0) the
same as the major number for the stable protocol. However, the current major
is ~(-1) to signify it being unstable, so don't use the major number as source
for setting or comparing protocol.
2010-06-23 12:18:41 +02:00
Alexander Larsson
72cf104c28 client: Support connecting to a major==1 server 2010-06-22 17:34:45 +02:00
Alexander Larsson
5c05a24ba1 Convert client to use indirect calls for message marshalling
This is required to support multiple versions
2010-06-22 10:54:59 +02:00
Alexander Larsson
ee91ed475d Switch client to use generated marshallers 2010-06-18 20:27:32 +02:00
Alexander Larsson
4154d70289 Client: Use the autogenerated demarshallers
When a message has been read from the network we now pass it into
the generated demarshaller for the channel. The demarshaller converts
the network data to in-memory structures that is passed on to the
spice internals.

Additionally it also:
* Converts endianness
* Validates sizes of message and any pointers in it
* Localizes offsets (converts them to pointers)
* Checks for zero offsets in messages where they are not supported

Some of this was previously done using custom code in the client, this
is now removed.
2010-06-18 16:32:11 +02:00
Alexander Larsson
c97116aeb9 Relicense everything from GPL to LGPL 2.1+ 2010-04-13 22:22:15 +02:00
Yonit Halperin
88aa56045a client: handling SPICE_MSG_MAIN_MIGRATE_SWITCH_HOST
disconnecting from the current host and connecting to the target host.
2010-04-06 14:56:46 +02:00
Yonit Halperin
457693fcfa client: add command line support for ciphers, ca file, and host certificate subject 2010-03-18 10:21:47 +01:00
Alexander Larsson
1f51697852 Rename symbols that were changed in spice-protocol
This is an automatic change using:
$ find -name "*.[ch]" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
$ find -name "*.cpp" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
2010-02-04 18:49:00 +01:00
Yonit Halperin
3eae1c80d9 server,client: server authentication for secured channels.
3 available mechanisms:  by public key, by host name, and by certificate subject name.
In the former method, chain of trust verification is not performed.
The CA certificate files are looked for under <spice-config-dir>/spice_truststore.pem

windows <spice-config-dir>=%APPDATA%\spicec\
linux <spice-config-dir>=$HOME/.spicec/
2010-01-11 19:10:54 +02:00
Yaniv Kamay
68fb440129 client: add GUI infrastructure + functional login dialog 2009-12-28 12:38:58 +02:00
Yaniv Kamay
2dbaf8c00c client: smiplify DisconnectedEvent 2009-12-28 12:36:46 +02:00
Yaniv Kamay
c6435ea02b client: wait for disconnect state in RedClient::connect() 2009-12-28 12:35:54 +02:00
Yaniv Kamay
3b51087b36 client: interactive screen layer 2009-11-30 18:03:35 +02:00
Yonit Halperin
2e4d709805 spice client: fixed missing AutoRef 2009-11-09 19:48:52 +02:00
Yonit Halperin
ec34856fea spice client: remove timer interface from platform - use Application (via ProcessLoop interface). 2009-11-09 19:06:44 +02:00
Yonit Halperin
8d5b738ba1 spice client: creating a general process loop.
The process loop is responsible for: 1) waiting for events 2) timers 3) events queue for
actions that should be performed in the context of the thread and are pushed from other threads.
The benefits:
1) remove duplicity: till now, there was one implementaion of events loop for the channels and
another one for the main thread.
2) timers can be executed on each thread and not only on the main thread.
3) events can be pushed to each thread and not only to the main thread.
In this commit, only the main thread was modified to use the new process loop.
2009-11-09 14:39:33 +02:00
Yaniv Kamay
c1b79eb035 fresh start 2009-10-14 15:06:41 +02:00