| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch will replace the common/ directory with the spice-common
project. It is for now a simple project subdirectory shared with
spice-gtk, but the goal is to make it a proper library later on.
With this change, the spice-server build is broken. The following
commits fix the build, and have been seperated to ease the review.
v2
- moves all the generated marshallers to spice-common library
- don't attempt to fix windows VS build, which should somehow be
splitted with spice-common (or built from tarball only to avoid
generation tools/libs deps)
v3
- uses libspice-common-client
- fix a mutex.h inclusion reported by Alon
|
|
|
|
|
|
| |
These turn into errors because of our -Werror use, breaking the build.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
| |
There is no more usage of epoll on the client side, so no need to
include these header files.
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RHEL-6 Bugzilla: 695323
cherry-picked from qspice commit
003667ac99beeec9b330a07bc3569c59a96d4588
which fixes RHEL-5 541566
with merge of the one line qspice fix to SPICE_REQUIRES:
9f3fe4755f11044a45c4b21148466a997fcbf735
spice: fixed reference to xinerama pkg config file
(Xinerama.pc=>xinerama.pc)
Author: Yonit Halperin <yhalperi@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
XMonitor::do_restore (called for example when going out of
fullscreen) restore the screen resolution to its previous state,
but it doesn't take care of repositioning the screen to their
previous position, which is one of the advantages of using randr
1.2.
Since MultyMonScreen::restore handles all of this for us, just call
it to restore the monitor position/resolutions to their previous
settings. Before doing any changes, MultyMonScreen::restore checks
if there's something to do, so calling it once per monitor won't be
an issue, the resolution/position will only be set the first time.
This has the side-effect of fixing bug #693431. This bug occurs when
closing the client after the client went in and out of fullscreen.
MultyMonScreen::~MultyMonScreen calls MultyMonScreen::restore, which
decides to change the screen positions since they were lost when going
to fullscreen because XMonitor::restore didn't restore the positions.
After this change, the positions will be properly restored and
MultyMonScreen::restore won't be needlessly called upon client
shutdown.
|
|
|
|
|
|
|
|
|
| |
MultyMonScreen::restore changes the X11 Screen resolution, but it
doesn't use MultyMonScreen::set_size. This means
MultyMonScreen::_width and MultyMonScreen::_height don't get
updated to reflect the new resolution settings, which could cause
issues later on. Until now this was safe since the only caller of
MultyMonScreen::restore was MultyMonScreen destructor.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To be able to enable/disable keyboard leds on X11, we need to query
the X server for which mask correspond to which led (NumLock,
CapsLock). So far this was done using XKeysymToKeycode and iterating
over X modifier mapping.
Xkb provides XkbKeysymToModifiers for this purpose, and since
we're using Xkb anyway, it makes more sense to use it.
At some point, on my Fedora 15 box, XKeysymToKeycode was returning
NoSymbol for CapsLock and NumLock leading to spicec not being able
to change the keyboard leds when qemu tells it to. However, I couldn't
reproduce this when I tried again :-/
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
There is a double free in client/x11/platform.cpp.
In get_selection(), in the exit: case with ret_val == -1 and data != NULL,
*data_ret (which is returned to the caller) has already been
assigned "data", so it will be pointing to freed memory when "data" is
XFree'd'. Then in handle_selection_notify, get_selection_free is called on
this pointer, which causes a double free.
When the length of the read data = 0, set the returned value to NULL,
this way subsequent free attempts will be a noop.
Fixes RH bug #710461
|
|
|
|
|
| |
vinfo in x11/platform.cpp is allocated using new[] so it needs to
be freed with delete[]
|
|
|
|
| |
This is more explicit about what it does, and not much longer
|
|
|
|
|
|
|
|
| |
When using config.h, it must be the very first include in all source
files since it contains #define that may change the compilation process
(eg libc structure layout changes when it's used to enable large file
support on 32 bit x86 archs). This commit adds it at the beginning
of all .c and .cpp files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although ICCCM 2.2. Responsibilities of the Selection Owner:
http://tronche.com/gui/x/icccm/sec-2.html#s-2.2
Clearly states (about selection notify events):
The owner should set the specified selection, target, time, and property
arguments to the values received in the SelectionRequest event.
xsel sets the selection notify event target member to the incr atom when it
is going to send the clipboard data incremental, rather then setting it to
the UTF8_STRING atom (which was the target of the SelectionRequest).
Work around this (esp as it is likely other programs may get this wrong too)
and accept the incr atom as a valid target in a selection notify event.
This fixes Alon's test with running:
python -c "print list(range(1000))" | xsel -i -b
on the client.
|
|
|
|
|
|
|
|
|
| |
Some apps (bad xsel, bad!) send invalid Atoms in their TARGETS property,
causing spicec to exit because of an XError. This patch makes spicec survive
this scenario.
For more info on the xsel bug, see:
https://bugzilla.redhat.com/show_bug.cgi?id=690214
|
|
|
|
|
|
|
| |
This avoids us trying to restore the original resolution when we're fullscreen
and an X error happens. As restoring fullscreen is a bad idea then as this
involves making more X calls, which can get us stuck (in side an XLockDisplay
call for example).
|
|
|
|
|
| |
gcc 4.6.0 added "[-Werror=unused-but-set-variable]", this and the next
few fixes tend to that. Mostly harmless.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When XIM + ibus is in use XIM creates an invisible window for its own
purposes, we sometimes get a _GTK_LOAD_ICONTHEMES ClientMessage event on
this window. Since this window was not explicitly created by spicec, it
does not have a Window Context (with the event handling function for the
window in question) set. This would cause spicec to throw an unhandled
exception and exit.
This patch replaces the exception throwing with silently ignoring
ClientMessage events on Windows without a Context and logging a warning
for other event types.
|
|
|
|
|
| |
These rarely happen as most apps have the decency to do a SetSelectionOwner
None before exiting. But some do not, so listen for these too.
|
|
|
|
|
|
| |
XRRSet* calls wait for a XReply, so add a missing XLockDisplay,
this fixes a hang (due to a race so not always) when switching between
windowed and fullscreen mode.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since libX11-1.3.4 the multi-threading handling code of libX11 has been
changed, see:
http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=933aee1d5c53b0cc7d608011a29188b594c8d70b
This causes several issues. One of them is the display inside the
client not getting updated when there are no XEvents being generated,
this is caused by the following part of the referenced commit message:
Caveats:
- If one thread is waiting for events and another thread tries to read a reply,
both will hang until an event arrives. Previously, if this happened it might
work sometimes, but otherwise would trigger either an assertion failure or
a permanent hang.
We were depending on the otherwise behavior and apparently were lucky.
This can be seen by starting F14 in runlevel 3 and then doing startx
and not touching the mouse / keyb afterwards. Once you move the mouse
(generate an event you see the UI contents being updated but not before.
Another thing both I and Alon (iirc) have seen are hangs where 2
threads are stuck in XSync waiting for a reply simultaneously. This might
be related to libxcb version, according to the libX11 commit a libxcb
newer then 1.6 was needed, and my system had 1.5 at the time I saw this
after updating to libxcb 1.7 I can no longer reproduce.
This patch tackles both problems (and is needed for the 1st one
indepently of the 2nd one possibly being fixed) by adding XLockDisplay
calls around all libX11 calls which wait for a reply or an event.
|
|
|
|
|
|
| |
Every time an events comes past where the Window is None (which happens
about once every 5 minutes or so), this annoying "invalid window" message
gets printed. Remove it!
|
|
|
|
|
|
|
|
|
|
|
| |
Well almost remove it, it was possible that another x11 app would acquire
selection ownership, and we would receive a release message from the
agent before having processed the xselection ownership change event.
Then we would set the selection owner to none, overriding the new owner.
As the comment in the patch indicates there still is a minute window left
where something similar can happen after this patch. Nothing we can do
about that (I blame the libX11 selection API).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
As we need a realloc function it is better to use malloc / free /
realloc then to diy, esp. as realloc can grow the buffer without
needing a memcpy.
|
|
|
|
|
|
|
|
|
|
|
| |
XSelectionRequest events must be answered in the order they were
received. But for TARGETS request we can answer directly, where as
other requests need to go through the agent. This causes us to handle
things out of order, and this can cause us to have more then one
requets outstanding with the agent, which is also not what we want.
So this patch introduces a queue for XSelectionRequest events, causing
us to handle them 1 at a time and always in order.
|
|
|
|
|
| |
And also handle many x11 targets (ie utf8 variants) to a single agent
type mapping.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
|
|
|
| |
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)).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We call XFixesSelectSelectionInput with the clipboard_atom, so we musr
initialize the atoms before calling XFixesSelectSelectionInput.
|
|
|
|
|
| |
send_selection_notify used the clipboard_event, so set it before calling
send_selection_notify.
|
|
|
|
|
| |
XGetAtomName() throws X11 errors when called on a None atom, so wrap
it catching the None case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-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
|
|
|
|
|
| |
This is a temporary fix as this will be fixed for real when
the cut and paste patches land.
|
|
|
|
| |
This was disabled by mistake before.
|
| |
|
|
|
|
|
| |
config.h should be availible everywhere, so move its inclusion
to the top of common.h.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|