Commit Graph

52 Commits

Author SHA1 Message Date
Hans de Goede
252ded1063 spicec-x11: handle multiple types per grab
And also handle many x11 targets (ie utf8 variants) to a single agent
type mapping.
2010-10-04 11:49:58 +02:00
Hans de Goede
57bfa782d8 spicec-x11: Add XFlush calls were needed
Since we do not always "pump" libX11's event loop by calling
XPending (we only call XPending when there is data to read from the
display fd), we must always explictly flush any outstanding requests.

This patch adds a whole bunch of missing XFlush calls.
2010-10-04 11:49:14 +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
a2492d5ae3 spicec-x11: Request targets from new clipboard owner
Request targets from new clipboard owner, rather then assuming UTF-8
(not entirely complete yet, the last pieces will be in another patch).

Atleast as important this code unifies the selection getting code
for incr and non incr getting of selection data so that it can be
used for both getting regular selection data and for getting targets
selection data.

This also fixes a big bug in the (I believe untested sofar) incr support
code which was interpreting the contents of PropertyNotify events as
XSelectionEvents rather then as XpropertyEvents which are completely
differen structs!
2010-10-04 11:49:10 +02:00
Hans de Goede
a3bf9d331d spicec-x11: remove clipboard_changer hack
Instead of keeping a flag, we can and should simply check wether the
new owner reported in the event it us or not. Also check for the
new owner being none and send a clipboard_release when that is the
case (through set_clipboard_owner(owner_none)).
2010-10-03 10:56:20 +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
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
Hans de Goede
c6e9c52a2a Call intern_atoms() earlier
We call XFixesSelectSelectionInput with the clipboard_atom, so we musr
initialize the atoms before calling XFixesSelectSelectionInput.
2010-10-01 17:02:12 +02:00
Hans de Goede
b882416070 Set clipboard_event before calling send_selection_notify
send_selection_notify used the clipboard_event, so set it before calling
send_selection_notify.
2010-10-01 17:00:28 +02:00
Hans de Goede
1ef6d280d1 wrap XGetAtomName
XGetAtomName() throws X11 errors when called on a None atom, so wrap
it catching the None case.
2010-10-01 16:57:08 +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
Alexander Larsson
e5474684d5 client: Avoid crash if platform_win is NULL
This is a temporary fix as this will be fixed for real when
the cut and paste patches land.
2010-09-29 17:48:28 +02:00
Alexander Larsson
92d286c6b5 client: Re-enable USE_XRANDR_1_2
This was disabled by mistake before.
2010-09-29 15:08:05 +02:00
Alexander Larsson
3f3283ee17 client: Fall back to gettimeofday if clock_gettime not found 2010-09-29 13:35:18 +02:00
Alexander Larsson
93dc13c91a client: Include config.h from common.h
config.h should be availible everywhere, so move its inclusion
to the top of common.h.
2010-09-29 13:26:21 +02:00
Alexander Larsson
44631aa023 client: Check for pthread yield function using autoconf 2010-09-29 13:16:45 +02:00
Hans de Goede
4efeef3302 spicec-x11: Fix going into a never ending loop upon xrandr event (#628573) (v2)
When handling an xrandr event the event_listener->on_monitors_change()
callback destroys and re-creates the monitor object(s) which results
in the DynamicScreen or MultyMonconstructor being called, which triggers
more xrandr events. This causes a never ending event handling loop making
spicec hang, and eventually making the X-server crash as a backlog
of events builds up and it oom's.

This patches this by explictly processing the xrandr event caused
by the constructor inside the constructor surrounded by the already
present guard code against recursive xrandr events.
2010-09-09 16:25:24 +02:00
Alexander Larsson
2df2b3df1e client: Handle async errors from xshm setup
XShmAttach can fail asynchronously, so we need to check the
errors in the x error handler during the XSync.
2010-08-25 12:19:46 +02:00
Alexander Larsson
7c7e3efff3 client: Don't leak xshm segments 2010-08-24 10:23:26 +02:00
Alexander Larsson
7c61dfee89 Don't try xshm any more if it fails for a permanent reason
This is copied from how Gtk+ detects Xshm failures.
2010-08-24 10:23:26 +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
Alon Levy
4f8545ed62 fix typo DisplayModeListner -> DisplayModeListener 2010-07-19 10:28:06 +03:00
Alexander Larsson
7e26ff3c26 Replace log4cpp with custom log function
Also prints a simpler error to stderr for WARN or above so that
we print something on the commandline if something go wrong.
2010-06-28 21:54:53 +02:00
Alexander Larsson
cfc1e95bda Make opengl optional, disabled by default
The OpenGL renderer isn't really useful right now, its not quite up
to date, its not really faster than software and it only supports a limited
subset of drivers. So, lets disable it for now.

Long term opengl rendering of the 2d part of spice is important if we want
to combine 2d and 3d rendering (say if spice adds opengl support in the
protocol). But until then this is isn't useful for normal use.
2010-06-21 14:50:18 +02:00
Alexander Larsson
012bd25779 Fix spelling errors in comments and strings 2010-05-21 10:51:28 +02:00
Gerd Hoffmann
e52974c7b4 fix two warnings 2010-04-26 14:01:37 +02:00
Alexander Larsson
d2a2f18b6e X11 client: Add helper for XImage construction 2010-04-23 16:36:35 +02:00
Alexander Larsson
4200c66cd7 Add utility functions to create XShm images 2010-04-23 16:36:35 +02:00
Alexander Larsson
cfa250caa2 Add XPlatform::get_screen_format for X11 2010-04-23 16:36:35 +02:00
Alexander Larsson
aeab661c5d Make client start if screen is 16bpp
The current glx code is looking for a rgb32 visual and always failing
if there is none. This means not even software rendering starts up
on e.g. 16bit visuals. This commit makes it pick software fallbacks
on 16bit visuals.

Long term we need to fix the gl implementation to do 16bpp too.
2010-04-23 16:36:31 +02:00
Alexander Larsson
9c02d15396 Client: Don't die if XIM not availible 2010-04-23 16:36:31 +02:00
Alexander Larsson
43a61bb6fe Detect XShm extension sanely
The previous way XShm detection worked failed at least for me, and is
not the standard way. We now just use XShmQueryExtension and
XShmQueryVersion.
2010-04-23 16:36:31 +02:00
Alexander Larsson
c97116aeb9 Relicense everything from GPL to LGPL 2.1+ 2010-04-13 22:22:15 +02: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
Alexander Larsson
a8ffd12e99 Filter out XIM X events
XIM ClientMessage events to an XIM internal window was triggering
the check for a window message procs. We need to properly filter
events with XFilterEvent to avoid this happening.
2010-02-04 16:11:38 +01:00
Yaniv Kamay
8ceb531958 client: add Platform::term_printf
Platform::term_printf is a variant of printf that
on windows dynamically opens console in order to
have visible output during command line processing.
2010-01-11 19:57:29 +02:00
Yaniv Kamay
3c1ff6448d client: fix logger init mix-up 2010-01-11 19:39:54 +02:00
Yaniv Kamay
ad12181027 client: move log file to spicec appdata dir 2010-01-11 19:30:39 +02: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
Arnon Gilboa
ea9af22e62 spice: position mouse in primary monitor center after full screen toggle
-move _focused & _pointer_in_window from RedWindow to RedWindow_p's
-move shadow focus & cursor handling to sync()
-add reset_cursor_pos() to Platform
-Monitor set_mode()/restore() use virtual do_set_mode()/do_restore()
2009-12-30 22:15:02 +02:00
Yaniv Kamay
68fb440129 client: add GUI infrastructure + functional login dialog 2009-12-28 12:38:58 +02:00
Izik Eidus
e93ef13b8f spice: client: add checks to see if it is safe to use XShem.
Beacuse that XShem internal checks wont fail when using the spice client
from remote, we are adding check on the socket family to see if it is
unix domain socket and fail in case it is not.

Signed-off-by: Izik Eidus <ieidus@redhat.com>
2009-12-22 21:34:55 +02:00
Yaniv Kamay
6c5966d8ed client: KeyHandler now receive unicode char event in addition to RedKey events 2009-11-30 18:22:13 +02:00
Arnon Gilboa
56eb1acb9e spice: add [pid:tid] to log lines 2009-11-18 13:36:43 +02:00
Arnon Gilboa
8b36ed5460 spice: on toggle_full_screen, generate on_key_down if shift is still pressed 2009-11-18 13:25:06 +02:00
Izik Eidus
54cf04beed client: fix colormap handling.
Signed-off-by: Izik Eidus <ieidus@redhat.com>
2009-11-09 22:34:05 +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
278c40f301 spice client: cosmetic changes 2009-11-09 17:38:27 +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