Commit Graph

866 Commits

Author SHA1 Message Date
Uri Lublin
9d2bd519a3 client: RedScreen::RedScreen: fix initialization order of _menu_needs_update
Related to a91b0b3ff7
(cherry picked from commit a3a3b34a46)
2011-12-22 11:43:39 +02:00
Uri Lublin
df17a852fa client: foreign-menu: pass "active" param when creating a ForeignMenu (#769020)
The default stays the same -- false.

A race could prevent setting ForeignMenu::_active correctly.
That happened when Application::on_app_activated was called before
_foriegn_menu was created. When foriegn_menu was created its
_active defaults to false, and that has not changed, until focus
was taken out and back in spice-client window.

This caused usbrdr to sometimes not auto-share devices, unless
the user switched focus to a different application and back to
spicec.

The fix updates ForiegnMenu::_active upon creation.
(cherry picked from commit fdcef17364)
2011-12-21 13:05:12 +02:00
Uri Lublin
7d8cc134bf client: update menu if needed when exiting full-screen mode (#758260)
(cherry picked from commit a91b0b3ff7)
2011-12-21 13:05:04 +02:00
Uri Lublin
67e785f4fc client: menu: make RedWindow::set_menu() return an error-code (#758260)
RedWindow::set_menu() can fail (on Windows when in fullscreen mode).
For Windows spice-client, when in fullscreen mode, the system-menu
is NULL.

Returns 0 upon success, non-0 (currently only -1) upon failure.

(cherry picked from commit 24d5852611)
(seperator vs separator --> a small typo that got fixed)
2011-12-21 13:04:01 +02:00
Uri Lublin
baa375e8b5 client controller/foreign_menu: use memmove instead of memcpy in readers
When src/dst memory areas may overlap, it's safer to use memmove.
(cherry picked from commit 5d28d1662e)
2011-12-21 12:58:07 +02:00
Gal Hammer
1f2d55b38b client: handle the redundant right ctrl windows' message send when a alt-gr is pressed bz#709074
Hello,

The second patch check to see if Windows is sending a fake VK_CONTROL
message when the user pressed Alt-Gr when using a non-US keyboard layout
(German, Czech, etc...).

If the function is_fake_ctrl return true and key event is translated to
a REDKEY_INVALID and the event is discarded.

     Gal.
(cherry picked from commit 9ffa2e9990)
2011-11-24 18:31:07 +02:00
Gal Hammer
66f611bccf client: handle the redundant right ctrl windows' message send when a alt-gr is pressed bz#709074
Hello,

I first updated the translate_key function. It now requires the windows
message as parameter (will be used later). It also use the raw wparam
and lparam parameters in order to remove the code duplication when
calling the function.

     Gal.
(cherry picked from commit 33be8633f5)
2011-11-24 18:31:04 +02:00
Arnon Gilboa
39ea97ce60 client: add xinerama support
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>

(cherry picked from master, commit a30d96faa49bca73f9c6000c4123a8ffb996ee1b)

Conflicts:

	client/Makefile.am
2011-11-13 14:43:42 +02:00
Alon Levy
80caf07e09 [0.8 branch] server: add main_dispatcher
add main_dispatcher, a message passing mechanism for sending messages to
the main thread. The main thread is the thread that implements
SpiceCoreInterface, which is assumed to be a single thread.

Similar to the async operation of red_worker, a socket pair is created
and used to pass messages. The messages are a fixed size to ease
parsing. A single message is defined to pass a channel_event.

RHBZ: 746950
FDBZ: 41858

This patch is 0.8 branch only, for the master branch there should be a
better approach to share code with red_dispatcher and ready the way for
later adding more threads.
2011-10-25 09:20:45 +02:00
Alon Levy
691afbbab5 server/tests: print pthread id on channel_event 2011-10-25 09:20:42 +02:00
Liang Guo
2c92a54712 spice-server.pc.in: move Requires to Requires.private
When using pkg-config, Requires and Requires.private field list
packages required by this package, but packages listed under
Requires.private are not taken into account when a flag list is
computed for dynamically linked executable. In the situation
where each .pc file corresponds to a library, Requires.private
shall be used exclusively to specify the dependencies between
the libraries.
2011-10-23 11:31:59 +02:00
Alon Levy
40640a3f30 server/smartcard: error packet sending. RHBZ 741259
fix wrongly applied master patch. With this it is identical to the
change in master commit
 b371824269
2011-09-27 23:23:40 +03:00
Yonit Halperin
4a26fa01cd Release 0.8.3 2011-09-26 12:18:00 +03:00
Yonit Halperin
4b2bf4d88c client: support semi-seamless migration between spice servers with different protocols.
It can't actually happen right now, since switch-host migration scheme will take
place if the src/target server has protocol 1.
2011-09-26 12:18:00 +03:00
Yonit Halperin
010b22cd77 client: display channel - destroy all surfaces on disconnect
Fix not destroying surfaces and other data (e.g., streams) upon disconnection.
2011-09-26 12:17:59 +03:00
Yonit Halperin
cad3c58544 client: display channel migration 2011-09-26 12:17:59 +03:00
Yonit Halperin
d3ed9d5e9d client: playback/record channels: implement on_disconnect 2011-09-26 12:17:59 +03:00
Yonit Halperin
f91d202eb3 client: main channel migration: do partial cleanup when switching hosts
Implement on_disconnect_mig_src and on_connect_mig_target in order to avoid
unnecessary cleanups done in on_(disconnet|connect).
In addition, do not request guest display settings changes after migration.
2011-09-26 12:17:58 +03:00
Yonit Halperin
510a4ff7c4 client: handle SPICE_MSG_MAIN_MIGRATE_END
(1) disconnect all channels from the migration src
(2) after all channels are disconnected, clean global resources
(3) send SPICE_MSGC_MAIN_MIGRATE_END to migration target
(4) wait for SPICE_MSG_MAIN_INIT
(4) switch all channels to migration target
2011-09-26 12:17:58 +03:00
Yonit Halperin
31ed2519a7 client: handle SpiceMsgMainMigrationBegin for 0.8.2
RHBZ 725009, 738270
2011-09-26 12:17:58 +03:00
Yonit Halperin
59e55605cc client: RedPeer::HostAuthOptions::set_cert_subject 2011-09-26 12:17:58 +03:00
Yonit Halperin
fcb3b4ce52 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.
2011-09-26 12:17:57 +03:00
Yonit Halperin
f29dc9b620 server: fix not calling migrate_connect completion callback
When the server is a migration target and spice_server_migrate_connect
is called before SPICE_MSGC_MIGRATE_END has been received, we start
the mig_timer. We handle the migrate_connect only when receiving SPICE_MSGC_MIGRATE_END.
If the mig_timer expires before that, we dismiss the request, and should call the
migrate_connect completion callback. Since reds->mig_inprogress
wasn't set appropriately, it wasn't called.
2011-09-26 12:17:57 +03:00
Yonit Halperin
524fcb3aa4 server: fall back to switch host scheme in case semi-seamless connection to target fails 2011-09-26 12:17:56 +03:00
Yonit Halperin
b821316771 server: turn spice_server_migrate_start into a valid call
We will add a qemu call to spice_server_migrate_start when migration starts.
For now, it does nothing, but we may need this notification in the future.
2011-09-25 15:04:08 +03:00
Yonit Halperin
ddf1188b30 server: call migrate_connect_complete callback when no client is connected 2011-09-25 15:04:08 +03:00
Yonit Halperin
4568f2dbbe server: handling semi-seamless migration in the target side
(1) not sending anything to the client till we recieve SPICE_MSGC_MIGRATE_END
(2) start a new migration (handle client_migrate_info) only after SPICE_MSGC_MIGRATE_END
    from the previous migration has been received
(3) use the correct ticket

Note: we assume the same channles are linked before and ater migration. i.e.,
SPICE_MSGC_MAIN_ATTACH_CHANNELS is not sent from the client.
2011-09-25 15:04:08 +03:00
Yonit Halperin
0e57df1dd1 server: move the linking of channels to a separate routine 2011-09-25 15:04:08 +03:00
Yonit Halperin
1081d8ccf0 server: move SPICE_MSG_MAIN_INIT sending code to a separate routine 2011-09-25 15:04:07 +03:00
Yonit Halperin
4b82580fc3 server: send SPICE_MSG_MAIN_MIGRATE_END on spice_server_migrate_end 2011-09-25 15:04:07 +03:00
Yonit Halperin
cfbd077105 spice.proto: add SPICE_MSG_MAIN_MIGRATE_END & SPICE_MSGC_MAIN_MIGRATE_END 2011-09-25 15:04:06 +03:00
Yonit Halperin
5560c56ef0 server,proto: tell the client to connect to the migration target before migraton starts
(1) send SPICE_MSG_MAIN_MIGRATE_BEGIN upon spice_server_migrate_connect
(2) wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR), or a timeout, in order
    to complete client_migrate_info monitor command
2011-09-25 15:04:05 +03:00
Yonit Halperin
55ccc022ec configure: spice-protocol >= 0.8.2 (semi-seamless migration protocol) 2011-09-25 15:04:05 +03:00
Yonit Halperin
3ac0075cda server: handle migration interface addition 2011-09-25 15:04:05 +03:00
Yonit Halperin
6e56bea67c server/spice.h: semi-seamless migration interface, RHBZ #738266
semi-seamless migration details:

migration source side
---------------------
(1) spice_server_migrate_connect (*): tell client to link
    to the target side - send SPICE_MSG_MAIN_MIGRATE_BEGIN.
    This should be called upon client_migrate_info cmd.
    client_migrate_info is asynchronous.
(2) Complete spice_server_migrate_connect only when the client has been connected
    to the target - wait for SPICE_MSGC_MAIN_MIGRATE_(CONNECTED|CONNECT_ERROR) or a timeout.
(3) spice_server_migrate_end: tell client migration it can switch to the target - send
    SPICE_MSG_MAIN_MIGRATE_END.
(4) client cleans up all data related to the connection to the source and switches to the target.
    It sends SPICE_MSGC_MAIN_MIGRATE_END.

migration target side
---------------------
(1) the server identifies itself as a migraiton target since the client is linked with (connection_id != 0)
(2) server doesn't start the channels' logic (channel->link) till it receives SPICE_MSGC_MAIN_MIGRATE_END
    from the client.

*   After migration starts, the target qemu is blocked and cannot accept new spice client
    connections. Thus, we trigger the connection to the target upon client_migrate_info
    command.
2011-09-25 15:04:04 +03:00
Christophe Fergeau
b353c8e04f 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-20 16:12:30 +02:00
Marc-André Lureau
d8e7839054 fix infinite loop in resolution change
After hours of investigation, I am a bit clueless.. It seems XRR is sending
us spurious ScreenChangeNotify in a loop. So we keep calling
init_monitors(), which creates new platform_win etc.. Although none of the
clients seems to be resetting the screen (checked all XRRSet..). The fact
that we create many platform_win looks like a bug to me, and indeed, it
seems to help if we reuse the same platform_win over the various
init_monitors() calls.

Fixes rhbz #692833
2011-09-20 16:08:30 +02:00
Christophe Fergeau
d27a6708b0 fix 2 X11 related leaks 2011-09-20 16:08:30 +02:00
Christophe Fergeau
2cf6022100 channel: fix EVP_PKEY leak 2011-09-20 16:08:30 +02:00
Christophe Fergeau
97ebbc1c0b 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-09-20 16:08:30 +02:00
Christophe Fergeau
ff8c54d766 fix integer marshalling helpers on big endian
They were trying to convert the destination pointer to an integer before
trying to dereference it. The initial conversion was meant to be a cast
to a pointer of the right size, not to an integer.
2011-09-20 16:08:30 +02:00
Christophe Fergeau
3c03489a27 fix typo in big endian code path
uint63_t should be uint64_t
2011-09-20 16:08:30 +02:00
Alon Levy
506f035682 server/smartcard: fix smartcard_channel_send_error
It was sending the wrong data, the memory right after the VCSMsgHeader
which was actually not where the data was.

Fixed by having the header and data (VSCError, 4 bytes of the error code)
embedded in the ErrorItem pipe item.
2011-09-20 16:08:30 +02:00
Yonit Halperin
11fe46f139 client: setting monitors resolution before resizing screens, RHBZ #728252
fix for "client: fix endless recursion in rearrange_monitors, RHBZ #692976"
2011-08-25 15:04:27 +03:00
Alon Levy
6862c810f3 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:02:03 +03:00
Alon Levy
13e38cdba6 server/red_dispatcher: fix wrong resolution set for tablet
when changing resolutions due to the new async code paths the surface
creation command was kept by reference, and later, when the red_worker
signaled completion by calling async_complete the mouse mode was updated
using the reference. This caused the wrong values to be read resulting in wrong
resolutions set and a non working mouse pointer. Fix this by keeping a copy of
the surface creation command instead of a reference.

No bz. Found in testing.
2011-07-31 17:49:47 +03:00
Christophe Fergeau
0c8438c7ff 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:49 +03:00
Hans de Goede
54c660470a Drop unnecessary X11 and alsa requires from spice-server.pc 2011-07-27 02:07:01 +02:00
Yonit Halperin
c8d63ceb2f server: not reading command rings before RED_WORKER_MESSAGE_START, RHBZ #718713
On migration, destroy_surfaces is called from qxl (qxl_hard_reset), before the device was loaded (on destination).
handle_dev_destroy_surfaces led to red_process_commands, which read the qxl command ring
(which appeared to be not empty), and then when processing the command
it accessed unmapped memory.
2011-07-24 12:25:58 +03:00
Alon Levy
f0e5a3cb77 Release 0.8.2 2011-07-22 16:37:02 +03:00