Commit Graph

387 Commits

Author SHA1 Message Date
Yonit Halperin
6cd3ffba6f client: handle SpiceMsgMainMigrationBegin (semi-seamless migration)
RHBZ 725009, 738270
(cherry picked from commit 31ed2519a7 branch 0.8)

Conflicts:

	client/red_client.cpp
2011-11-02 11:30:23 +02:00
Yonit Halperin
f22caf9aee client: rewrite surfaces cache
use std::map instead of a specific template (CHash).
There is no need for special template. Moreover, using
std::map will allow easy iteration over the surfaces.
(cherry picked from commit fcb3b4ce52 branch 0.8)

Conflicts:

	client/display_channel.cpp
2011-11-02 11:30:21 +02:00
Christophe Fergeau
bc9306852d client/x11: reset screen positions in XMonitor::do_restore
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.
2011-10-05 15:09:48 +02:00
Christophe Fergeau
e3e04b0a2a client/x11: fix mode setting in MultyMonScreen::restore
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.
2011-10-05 15:09:47 +02:00
Christophe Fergeau
ae3e63a9d8 client/x11: fix typos (finde => find) 2011-10-05 15:09:46 +02:00
Christophe Fergeau
45ef140e23 client: fix typo commnad=>command 2011-09-20 14:51:45 +02:00
Christophe Fergeau
26e172e4be client: don't crash when booting a Xinerama setup
In a Xinerama setup, when X starts up and creates one of the
secondary screens, first a non-primary surface is created on the
secondary screen, and then the primary surface for this screen is
created.
This causes a crash when the guest uses Xinerama and the client
is attached to the VM before X starts (ie while the guest is
booting).
This happens because DisplayChannel::create_canvas (which is called
when creating a non-primary surface) assumes a screen has already been
set for the DisplayChannel while this only happens upon primary surface
creation. However, it uses the screen for non important stuff, so we
can test if screen() is non NULL before using it. This is what is done
in other parts of this file.

Fixes rhbz #732423
2011-09-19 18:33:33 +02:00
Christophe Fergeau
a20e6bb012 fix typos
applicaion => application
Attache => Attach
Detache => Detach
_layes => _layers
2011-09-15 10:24:45 +02:00
Marc-André Lureau
7e1c773325 fix bug #692833 2011-09-01 03:58:01 +02:00
Yonit Halperin
c5b6bacee1 client: setting monitors resolution before resizing screens, RHBZ #728252
fix for "client: fix endless recursion in rearrange_monitors, RHBZ #692976"
2011-08-25 14:27:24 +03:00
Christophe Fergeau
3d31e36bf2 use Xkb to get keyboard modifier mask
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 :-/
2011-08-17 10:42:19 +02:00
Christophe Fergeau
f2b4c3d21a fix harmless typo in InputsChannel::handle_modifiers
InputsChannel::handle_modifiers converts _modifiers which is a
bitflag of SPICE_KEYBOARD_MODIFIER_FLAGS_* to a Platform::*_MODIFIER
bitflag, which is what Platform::set_keyboard_lock_modifiers expects.
However, it's called with _modifiers, and the bitflag that this
function computes is never used. Pass the computed bitflag to
::set_keyboard_lock_modifiers since _modifiers format is meaningless
for ::set_keyboard_lock_modifiers.
This bug was harmless because the two different set of modifier
flags actually use the same values, so _modifiers and modifiers could
be used interchangeably. However it's more future-proof to use the
right format here.
2011-08-17 10:42:18 +02:00
Christophe Fergeau
0d4bd55042 fix 2 X11 related leaks 2011-08-15 11:22:56 +02:00
Christophe Fergeau
d7d0a3a98e channel: fix EVP_PKEY leak 2011-08-15 11:22:47 +02:00
Christophe Fergeau
855f2ed2ac always set VDAgentDisplayConfig::depth
Even if VDAgentDisplayConfig::depth will be unused if the
VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH isn't set, it's
better to initialize it anyway to avoid warnings from valgrind.
2011-08-15 11:22:42 +02:00
Alon Levy
f19ac970ef client/red_client: fix broken switch host migration (RHBZ 727969)
3f8d7e59db introduced a regression, after
sending one attach_channels message we never send another one.
Fix by resetting on disconnect.
2011-08-03 23:01:42 +03:00
Liang Guo
39867cb4df Fix typo: treshold -> threshold 2011-08-02 11:13:49 +02:00
Liang Guo
a2433172c8 Fix typo: seperator -> separator 2011-08-02 11:13:49 +02:00
Christophe Fergeau
759fe8e270 client: fix 30s timeout regression
Changelog from Arnon Gilboa, patch from me:

Commit eb6f554094 caused the following regression:

When client runs without the auto-conf or disable-effects options
(either from CLI or controller), which is the case when using Spice
from Admin Portal, the client will unecessarily wait for 30sec before
connecting to a Windows guest with an agent running (this won't happen
with linux guests or without an agent running).

The mentioned patch assumed that on_agent_reply() of
VD_AGENT_DISPLAY_CONFIG will call send_main_attach_channels() and
connect. However, when auto-conf or disable-effects are not used,
on_agent_reply() will ignore the reply and not call
send_main_attach_channels(). Therefore, send_main_attach_channels()
will only be called on agent timeout.

The solution is to activate agent timer only if auto-conf or
disable-effects. Otherwise, simply call send_main_attach_channels().

Fixes rhbz #726441
2011-07-31 13:32:28 +03:00
Christophe Fergeau
e0e8d091ff fix make distcheck 2011-07-22 10:24:30 +02:00
Christophe Fergeau
eb6f554094 client: don't die if initial agent timeout triggers
When the client connects to a spice VM, if an agent is detected,
there will be a few messages exchanged to exchange capabilities,
display resolutions, ... This exchange has a timeout in case
something goes wrong. However, when it fires, the client dies.
This commit changes this and lets the client connects to the
guest when the timeout happens.
rhbz #673973
2011-07-22 10:24:30 +02:00
Christophe Fergeau
fc2f7d14a2 client: only send one SPICE_MSGC_MAIN_ATTACH_CHANNELS messages
492f7a9b fixed unwanted timeouts during initial client startup,
but it also caused a bad regression when connecting to
RHEL6+agent guests: the SPICE_MSGS_MAIN_ATTACH_CHANNELS message
was sent multiple times, once in RedClient::handle_init, then
once again in RedClient::on_agent_announce_capabilities (which
can even be triggered multiple times). Sending this message multiple
times is a big NO and causes the server to close the client connection,
and the client to die. Add a _msg_attach_message_sent boolean to
make sure we only send this message once.

rhbz #712938
2011-07-22 10:24:30 +02:00
Christophe Fergeau
d81578ec0c client: split overlong option descriptions 2011-07-22 10:24:29 +02:00
Yonit Halperin
419222f0f3 client: fix endless recursion in rearrange_monitors, RHBZ #692976
The endless recursion happens due to Application::prepare_monitors calling RedScreen::resize
calling Application::rearrange_monitors calling Application::prepare_monitors

I changed RedScreen::resize not to call rearrange_monitors. Instead,
the monitor should be configured correctly from Application, before
calling resize.
In addition, I made some cleanups to allow reusing rearrange_monitors code.
2011-07-21 12:43:37 +03:00
Hans de Goede
77a9a62556 spicec: Make loglevel configurable through the environment
Having a loglevel variable is much more useful if we can actually change
its value without a recompile. Use a SPICEC_LOG_LEVEL environment variable so
we can do this from the spice xpi / activex too (by setting the environment
variable before starting the browser).
2011-07-21 11:15:24 +02:00
Christophe Fergeau
b8a1de3274 client: add missing "," in option list
In commit 44073d1b38 - client: improve WAN option description
one "," was missing at the end of the line. Since the next argument
was a string too, gcc silently concatenated them, and thanks to C++
polymorphic functions, the compiler didn't complain about the
missing argument, so it went unnoticed.
The effects are pretty bad though, since it prevents spicec from
running because it thinks command line parsing fails.
2011-07-19 13:31:10 +02:00
Uri Lublin
082431ba8d client: rename connect_unsecure to connect_to_peer
Both connect_secure() and connect_unsecure() call connect_to_peer().

Prior to this commit spicec.log reported all connections as unsecure,
as connect_secure() called connect_unsecure() to make the connection.
This fixes RH bug #653545
2011-07-18 18:15:40 +02:00
Christophe Fergeau
492f7a9b84 client: don't crash when agent is missing WAN support
If you try to connect to a linux guest with WAN options, SPICE window opens up
and is blank - it then fails with vdagent timeout message.  It should give a
warning that this is only applicable for windows guest and still connect to
guest.

It all starts in RedClient::handle_init
This function checks whether we have an agent or not, because if we have an
agent, there will be some kind of handshake to check both sides capabilities
before all the spice channels are created.

When there is no agent running, the startup process goes on with
SPICE_MSGC_MAIN_ATTACH_CHANNELS

When there is a windows agent running, VD_AGENT_ANNOUNCE_CAPABILITIES and
VD_AGENT_DISPLAY_CONFIG messages are sent to the agent, and when processing the
agent answer to the VD_AGENT_DISPLAY_CONFIG message,
SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent and the startup process will go
on.

However, when there is no agent running but --color-depth was used, handle_init
won't send the SPICE_MSGC_MAIN_ATTACH_CHANNELS message but will wait for the
agent handshake to proceed to its end, which won't happen, so it will timeout
waiting for agent answers.

Similarly, the linux agent handles VD_AGENT_ANNOUNCE_CAPABILITIES messages, but
it doesn't handle VD_AGENT_DISPLAY_CONFIG messages, so we'll never reach the
point where a SPICE_MSGC_MAIN_ATTACH_CHANNELS will be sent.

This commit fixes this in 2 places:
- unconditionnally send SPICE_MSGC_ATTACH_CHANNELS when no agent is running in
handle_init
- send SPICE_MSGC_MAIN_ATTACH_CHANNELS in
RedClient::on_agent_announce_capabilities if the agent doesn't have the
VD_AGENT_CAP_DISPLAY_CONFIG capability

This fixes RH bug #712938
2011-07-18 18:15:40 +02:00
Christophe Fergeau
44073d1b38 client: improve WAN option description
The WAN options (--color-depth and --disable-effects) need
support from the guest agent to be working. Currently they are
only supported on Windows. While I don't want to explicitly
mention Windows in --help output, we can hint that it won't
work with all guests in --help. This fixes RH bug #712941
2011-07-18 18:15:40 +02:00
Christophe Fergeau
933ca15ff4 x11: don't return freed memory from get_clipboard
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
2011-07-18 18:15:39 +02:00
Christophe Fergeau
40043d3bc2 client: match delete[] with new[]
vinfo in x11/platform.cpp is allocated using new[] so it needs to
be freed with delete[]
2011-07-18 18:15:39 +02:00
Christophe Fergeau
659499478e client: s/recive/receive 2011-07-18 18:15:39 +02:00
Marc-André Lureau
d1758b3288 sndworker: add AudioVolume/AudioMute messages
These messages allow the guest to send the audio device volume to the
client. It uses an arbitrary scale of 16bits, which works good enough
for now.

Save VolumeState in {Playback,Record}State, so that we can send the
current volume on channel connection.

Note about future improvements:
- add exact dB support
- add client to guest volume change

Updated since v2:
- bumped record and playback interface minor version to allow
  conditional compilation
Updated since v1:
- sync record volume on connection too
2011-06-22 12:12:26 +02:00
Yonit Halperin
8131249d6c client: fix for redundant shift+f11 RHBZ #674532
After shift+F11, both in Windows 7 and xp clients, WM_KEYUP events were missing for
SHIFT and F11. For F11 it was less important since unpress_all was preformed for all keys.
However, we perform sync for all the keyboard modifiers and the GetKeyboardState returns "down" for shift.
In windows7 client, we sometimes received afterwards a F11 KEYDOWN event repetition, and this caused SHIFT+F11 to be called again.
Not performing hiding of the windows while changing client resolutions, solved the problem of missing events, and I don't see any difference
in how spice looks while toggling to full screen.
Using GetAsyncKeyState, returns "UP" for shift in windows 7, and helps avoid performing shift+f11 again, if there is an F11 repetition
before we receive the KEYUP event for shift.
2011-06-14 10:15:41 +03:00
Arnon Gilboa
d1a1a1b4c7 client/windows: enable image randomization (ASLR) rhbz#701111
Enable image randomized base address, hindering some types of
security attacks by making it more difficult for an attacker
to predict target addresses.
2011-05-30 10:02:19 +03:00
Arnon Gilboa
ec56898570 client/windows: remove slash from x64 build dir
otherwise x64 is built in root if REDC_BUILD_DIR is not defined
2011-05-30 10:02:12 +03:00
Arnon Gilboa
a973e87a05 client/windows: remove precompiled header for common.h (fix broken windows debug build)
-Release currently doesn't use precompiled headers at all
-Debug is broken since common/*.c files don't include common.h
-PCH can be enabled for all but specifically-chosen c-files
2011-05-22 14:59:55 +03:00
Yonit Halperin
d63fd4c5b0 client: fix flipped video in Linux guest on windows client, RHBZ #667689
Video streams from Linux guests are oriented top-down, where gdi_canvas_put_image always
received display context for down-top oriented bitmap. I fixed create_bitmap
to consider the stream orientation.
2011-05-19 12:57:41 +03:00
Arnon Gilboa
8776562115 client/windows: undef SIZE_MAX in stdint.h
eliminating redefinition warning
2011-05-12 15:21:07 +03:00
Arnon Gilboa
ccddcdb82a client/windows: add common\ssl_verify.c/h to project
disable WarnAsError, due to c/c++ warnings
2011-05-12 15:13:40 +03:00
Arnon Gilboa
4ea4d4dc35 client/windows: inc version to 0,9,0,0 2011-05-12 15:13:39 +03:00
Arnon Gilboa
d3577b2772 client/windows: init PACKAGE_VERSION
in windows, we set PACKAGE_VERSION to the binary version
since we don't have config.h as generated by linux configure
2011-05-12 15:13:39 +03:00
Alon Levy
34e9375cc0 client: fix return code when missing host 2011-05-12 12:38:23 +03:00
Marc-André Lureau
d46f9d3f4e client: make use of ssl_verify.c
Fixed since v1:
- don't include C code, rather use the common lib
- add missing spice_openssl_verify_free() call
- keep the extra-parsing of subject for error reporting
2011-05-03 17:16:46 +02:00
Marc-André Lureau
27f771566d common: add windows.h where required, make gdi_handlers static
This patch has not been verified with VS/brew. It should be safe
hopefully. Compilation is fine with mingw32/spice-gtk.
2011-05-03 16:49:56 +02:00
Christophe Fergeau
1caee1f216 client: remove unused mb() macro 2011-05-03 14:44:11 +02:00
Christophe Fergeau
e17767e892 add missing static 2011-05-03 14:44:11 +02:00
Christophe Fergeau
4a989d6c7a win32: remove obsolete preprocessor #defines
SW_CANVAS_NO_CHUNKS isn't used anywhere but in this file.
SW_CANVAS_CACHE is now defined directly in the files where it's
needed so we no longer need it in the .vcproj file.
2011-05-03 14:44:11 +02:00
Christophe Fergeau
e0c20725c8 s/USE_OGL/USE_OPENGL
This is more explicit about what it does, and not much longer
2011-05-03 14:44:11 +02:00
Christophe Fergeau
78c1465ed3 add #include <config.h> to all source files
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
2011-05-03 14:44:10 +02:00