Commit Graph

643 Commits

Author SHA1 Message Date
Alon Levy
673ade8a6f server: add char_device.h header, use in reds.c 2010-12-06 18:09:14 +02:00
Alon Levy
14f2b0f52a spice-experimental.h: add multiple include protection 2010-12-06 18:09:14 +02:00
Alon Levy
dc8946f9f4 server/vdi_port (virtserial): always read data
We erronously ignored data from guest on the serial channel if no client is
connected. This leads to an assert when the guest writes a second time, since
there is still data unconsumed by us (the host).
Fix by reading data anyway, and discarding it after parsing (and reading) whole
messages from the guest.
Net affect is that any messages the agent sends while no client is connected
get discarded, but only full messages are discarded.
This fixes an abort if booting a winxp guest with vdagent without a connected
client.
2010-12-06 13:20:14 +02:00
Alon Levy
3eac546309 server: add char_device.h to Makefile.am for make dist 2010-12-02 17:17:11 +02:00
Alon Levy
9002d3f005 server/tests: add test_display_no_ssl
updates taken from spice vga mode updates, i.e. non cacheable, glz compressed
(depends on whatever settings you apply to the server) opaque draw operations.
 + completed the SpiceCoreInterface implementation (timers)

v1->v2:
 removed test_util.c (Hans)
 replaced mallocz with calloc (Hans)
2010-11-30 21:03:14 +02:00
Alon Levy
74b39efd6e server/tests: Makefile.am fixes
* don't install tests on make install
 * don't forget anything for make dist tarball
2010-11-30 21:01:06 +02:00
Alon Levy
eb79d1e568 add .gitignore for tests 2010-11-30 20:54:49 +02:00
Hans de Goede
aa3e19bfa4 spicec: Don't show a white screen if guest resolution does not fit fullscreen
Currently when going / starting fullscreen if the guest resolution for one of
the monitors is higher then that monitor on the client can handle, we show a
white screen. Leaving the user stuck (unless they know the fullscreen key
switch combi) with a white screen when starting the client fullscreen from
the XPI.

This patch changes the client to fall back to windowed mode in this case
instead.
2010-11-25 11:23:02 +01:00
Arnon Gilboa
eb3efa3cbb spicec: fix ASSERT to accept size == 0
which is useful when calling RedClient::on_clipboard_notify(VD_AGENT_CLIPBOARD_NONE, NULL, 0);
2010-11-24 13:09:10 +02:00
Arnon Gilboa
dd31c0cbfd spicec-win: add image copy-paste support
-currently png & bmp
-using wspice libs cximage.lib & png.lib
-jpg & tiff will follow
2010-11-24 10:30:40 +02:00
Hans de Goede
32d9486091 spicec-x11: Fix unhandled exception: no window proc crash (rhbz#655836)
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.
2010-11-23 18:18:48 +01:00
Hans de Goede
86e62813b3 spicec-x11: Fix modifier keys getting stuck (rhbz#655048)
Currently modifier keys (ctrl, alt) can get stuck when using the x11 client.
To reproduce under gnome:
-focus the client window without causing it to grab the keyborad (click on
 the title bar not the window)
-press crlt + alt + right arrow to switch virtual desktop
-press crlt + alt + left arrow to switch back
-notice ctrl + alt are stuck pressed

What is happening here is:
-We get a focus out event, caused by the hotkey combi key grab, focus event
 notify mode == NotifyGrab, and release all keys -> good
-We get another focus out event, as we really loose the focus.
 notify mode == NotifyWhileGrabbed, which we ignore as we already lost
 focus before
-We get a focus in event, as the focus is returning to us, but we don't
 really have the focus yet, as the hotkey combi key grab is still active
 (ie ctrl + alt are still pressed).
 We now sync the vm's modifier key state with the current X-server state,
 telling the vm ctrl + alt are pressed. Note we do this by directly reading
 the X-server keyboard status, we are not getting any key press events from the
 X-server -> bad
-We get another focus in event, as we really get the focus back,
 notify mode == NotifyUngrab. We ignore this one as already have gained the
 focus before. If we were to sync the vm modifier state here, all would be
 well we would no longer see the modifier keys pressed, or if we would we
 would get a release event when they get released (testing has shown both).

The solution here is to ignore the first focus in event, and do the modifier
sync on the second focus in event, or more in general to ignore focus events
where notify mode == NotifyWhileGrabbed.
2010-11-22 16:09:15 +01:00
Hans de Goede
e0911d1c92 spicec-x11: Add a few missing XLockDisplay calls (rhbz#654265)
The XIM functions end up waiting for a reply from the server, so they
need locking around them. Idem for the XLookupString call.
2010-11-17 12:31:53 +01:00
Hans de Goede
c278cfa88c spicec: Don't show gui when connection info is specified on the cmdline
Currently when compiled with the gui enabled if you specify a host to connect
to on the cmdline the gui flashes by (show_gui gets called, then the connect
handler calls hide_gui as soon as the connection is made).

This patch removes this ugly flashing by of the gui.
2010-11-09 13:03:58 +01:00
Hans de Goede
cec1d98029 spicec: Remove empty show / hide gui functions
When compiling without gui support just don't call show / hide
gui, rather then making them stubs, this makes it easier to follow what is
going on.
2010-11-09 13:03:57 +01:00
Hans de Goede
a6d76fb0fc spicec: Fix info layer sometimes not showing
Currently we are calling show_info_layer from hide_gui in application.cpp, but
there are 2 cases where this does not happen:

1) When compiled without gui support hide_gui is a complete nop, so we never
   show the info layer when compiled without gui support
2) When run with --controller we never show the gui, and hide_gui
   checks if there is a gui to hide as the first thing and if not returns
   resulting in show_info_layer not being called, and thus the info layer
   not showing when launched from the xpi

This patch fixes both by adding a call to show_info_layer from
on_visibility_start note that on_visibility_start also calls hide_gui,
so in some cases show_info_layer may be called twice, this is not a
problem as show_info_layer is protected against this.
2010-11-09 13:03:57 +01:00
Alon Levy
b6e530f5f3 server/reds: zap unsetting of QEMU_AUDIO_DRV 2010-11-08 17:53:17 +02:00
Alon Levy
6f9ab51509 gitignore: add generated_*, vim temps, pyc 2010-11-08 16:06:55 +02:00
Alon Levy
bd30095c75 reds: remove needless buffer in InputsState 2010-11-08 16:06:49 +02:00
Alon Levy
0ede43e893 server: tests: add basic tests with working do nothing server 2010-11-08 16:04:27 +02:00
Arnon Gilboa
6dbea1bda1 spicec-win: ignore MSVCRT.lib in x86 build
Same as in x64 build, for using the updated wspice-0.6.3
2010-11-08 10:39:01 +02:00
Hans de Goede
bfaa457910 spicec: Make cegui log to <app_data_dir>/cegui.log
This stops the client from dropping CEGUI.log files into the cwd all
the time, and stops it from crashing when the cwd is not writable
(rhbz#650253).
2010-11-05 20:46:28 +01:00
Hans de Goede
922b831db2 spicec-x11: Listen for selection owner window destroy / close events too
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.
2010-10-28 12:05:30 +02:00
Alon Levy
b4a776b03f client: add verbose link error messages 2010-10-25 14:59:12 +02:00
Arnon Gilboa
d9ea4242b1 spicec-tests: add controller_test (v2)
use chars for title & menu instead of wchars
2010-10-25 13:28:49 +02:00
Arnon Gilboa
429fae02ba spicec-win: remove redundent strdup & buggy free
text refered a substr of item_dup and was used after free(item_dup).
no need to strdup, we can destroy the resource string.
2010-10-25 13:22:24 +02:00
Hans de Goede
a1cef5b81a controller: Make menu text utf-8
We are making all text send over the controller socket utf-8, rather then
having somethings as 8 bit (hostname) and others (title, menu) unicode16,
this patch completes this change by converting the menu handling.
2010-10-25 11:36:35 +02:00
Hans de Goede
18e6edb93a spicec-x11: Do not set _NET_WM_USER_TIME to 0 on startup
Setting _NET_WM_USER_TIME to 0 means we do not want focus, not good.
2010-10-25 11:36:34 +02:00
Arnon Gilboa
a0f32b620b spicec-win: add x64 to vcproj & sln (v2)
use CEGUI for x64 as well, no need for the SUPPORT_GUI hack
2010-10-25 08:35:56 +02:00
Arnon Gilboa
7966058618 spicec-win: map title string from utf8 to utf16
Fix win client broken by the utf8 patch.
2010-10-25 08:35:34 +02:00
Arnon Gilboa
3d08b908b4 spicec-win: add #ifndef _WIN64 for u/intptr_t typedefs 2010-10-24 16:33:01 +02:00
Arnon Gilboa
66d89ee04f spicec-win: Replace Set/GetWindowLong to LongPtr for x64 competability 2010-10-24 16:32:49 +02:00
Hans de Goede
4c81024ca2 Remove no longer used wstring_printf functions 2010-10-21 13:22:01 +02:00
Hans de Goede
fa2e125ec4 client: Interpret the title control message as utf8 instead of unicode16
The activex browser plugin is sending unicode16 text, where as the
xpi one is sending utf8 text. After discussing this on irc we've decided
that utf8 is what we want to use. So the client (this patch), and the
activex will be changed to expect resp. send utf8 text as the title.
2010-10-21 13:19:51 +02:00
Hans de Goede
79fffbf95d spicec-x11: Change source of controller socket name, fixing CVE-2010-2792
The socket name used to communicate between the xpi browser plugin and the
spicec was predictable allowing a non priviliged user on the same system
to create the socket before spicec does and thus intercept the messages from
the xpi to the client, including login credentials. This security vulnerability
has been registred with mitre as CVE-2010-2792:
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-2792

This patch changes the controller code to instead read the socket name
from an environment variable which gets set by the xpi before executing
the spicec, making the socketname private between the client and the xpi.

Note that this means that the controller will only work with an xpi which
has matching changes, the changes are present in the latest version of the
xpi as available as update for / with RHEL-5.5 and RHEL-6.0 .
2010-10-21 13:06:14 +02:00
Hans de Goede
023d9c0d91 Release 0.6.3 2010-10-18 14:52:43 +02:00
Hans de Goede
df6df8e587 Make the gui use Application::hide_gui rather then hide_me
Now that Application::hide_me actually does what the name suggests
(hide the entire client, ie all client windows), the gui using it to
not show the gui layer leads to the entire client disappearing when
one presses close in the GUI or dismisses a GUI dialog. This patch makes
the GUI code call hide_gui instead of hide_me, fixing this.
2010-10-18 14:43:06 +02:00
Hans de Goede
bbc079955a Bump version to 0.6.2 2010-10-18 11:22:19 +02:00
Hans de Goede
cef69ac424 Update NEWS for 0.6.2 release 2010-10-18 11:18:48 +02:00
Hans de Goede
d08b8120d6 spicec-x11: Fix window management under KDE
There were 2 issues with window management under KDE
1) When an app does its own focus management like we do, kwin expects
   an explicit raise for the app to get to the top, so we did have focus,
   but would have other windows (partially) covering the client window
   -> do a raise after setting focus to ourselves
2) When switching from fullscreen <-> window, we unmap and remap our
   window, then set focus to ourselves. kwin thinks this means we're trying
   to steal the focus without the user asking for it. This patch makes us
   set the _NET_WM_USER_TIME property on our window, this helps kwin's
   focus stealing code to see that we are really not stealing the focus,
   just responding to a user event.
2010-10-18 10:40:51 +02:00
Hans de Goede
421ddb7422 client: change monitor mode setting <-> fullscreen window mode setting order
1) Make the order when starting up in fullscreen mode the same as when
   switching from window -> fullscreen:
   First set the mode, then make the window fullscreen
2) Change the order when leaving fullscreen mode, first restore the original
   monitor mode, then make the window non fullscreen. Changing the monitor
   mode in X11 causes the window manager to re-arrange windows, and if this
   happens while compiz is busy mapping the window it gets confused and
   maps the window with a maxmimized size.
2010-10-18 10:40:51 +02:00
Hans de Goede
0b07ca2775 spicec-x11: Change WmSizeHints in fullscreen mode
Some window managers will ignore the fullscreen hint, unless WmSizeHints
allow them to resize the window so that they can give it the size of
the roo-window. This fixes fullscreen mode in compiz.
2010-10-18 10:40:51 +02:00
Hans de Goede
203a39761f spicec-x11: Add missing XLockDisplay around XRRSet* calls
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.
2010-10-18 10:40:51 +02:00
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
Arnon Gilboa
4d0e6e525c spicec: add controller
Spice client controller enables external control (e.g., by XPI or ActiveX) of
the client functionality.

The controller protocol enables setting parameters (host, port, sport, pwd,
secure channels, disabled channels, title, menus, hotkeys etc.), connecting
the server, showing and hiding the client etc.

The controller is based on the cross-platform named pipe.
2010-10-18 10:17:28 +02:00
Arnon Gilboa
20c550d278 spicec: add foreign menu
Spice foreign menu enables external control of the client menu.

The foreignmenu protocol enables an external application to:
add a submenu, set its title, clear it, add/modify/remove an item etc.

Foreign menu is based on the cross-platform named pipe.
2010-10-18 10:03:46 +02:00
Arnon Gilboa
e789c8b9aa spicec-win: move named_pipe defines 2010-10-17 17:03:37 +02:00
Arnon Gilboa
b04bf7f9b0 spicec-win: fix menu id push to free_sys_menu_id 2010-10-17 17:03:33 +02:00
Arnon Gilboa
1d08cc1458 spicec: enable multiple CmdLineParser instantiations
Used by controller. One instance at a time, not thread-safe.
Add basename() for win32.
2010-10-17 17:02:49 +02:00
Arnon Gilboa
e8d4757451 spicec: name host param 2010-10-17 11:46:37 +02:00