diff --git a/Makefile.am b/Makefile.am
index c7a0e92d..cada94d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,10 +3,6 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = spice-common server docs
-if SUPPORT_CLIENT
-SUBDIRS += client
-endif
-
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = spice-server.pc
diff --git a/client/.gitignore b/client/.gitignore
deleted file mode 100644
index 0561c05c..00000000
--- a/client/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-*.la
-*.lo
-*.loT
-*.o
-.deps
-.libs
-Makefile
-Makefile.in
-generated_demarshallers.cpp
-generated_demarshallers1.cpp
-generated_marshallers.cpp
-generated_marshallers1.cpp
-spicec
diff --git a/client/Makefile.am b/client/Makefile.am
deleted file mode 100644
index 97b56f6c..00000000
--- a/client/Makefile.am
+++ /dev/null
@@ -1,249 +0,0 @@
-NULL =
-
-bin_PROGRAMS = spicec
-
-spicec_SOURCES = \
- application.cpp \
- application.h \
- audio_channels.h \
- audio_devices.h \
- cache.hpp \
- canvas.cpp \
- canvas.h \
- client_net_socket.cpp \
- client_net_socket.h \
- cmd_line_parser.cpp \
- cmd_line_parser.h \
- common.h \
- controller.cpp \
- controller.h \
- cursor.cpp \
- cursor.h \
- cursor_channel.cpp \
- cursor_channel.h \
- debug.h \
- display_channel.cpp \
- display_channel.h \
- event_sources.h \
- foreign_menu.cpp \
- foreign_menu.h \
- glz_decoded_image.h \
- glz_decoder.cpp \
- glz_decoder.h \
- glz_decoder_config.h \
- glz_decoder_window.cpp \
- glz_decoder_window.h \
- hot_keys.cpp \
- hot_keys.h \
- icon.h \
- inputs_channel.cpp \
- inputs_channel.h \
- inputs_handler.h \
- jpeg_decoder.cpp \
- jpeg_decoder.h \
- menu.cpp \
- menu.h \
- mjpeg_decoder.cpp \
- mjpeg_decoder.h \
- monitor.cpp \
- monitor.h \
- pixels_source.h \
- platform.h \
- playback_channel.cpp \
- process_loop.cpp \
- process_loop.h \
- read_write_mutex.h \
- record_channel.cpp \
- red_canvas_base.h \
- red_channel.cpp \
- red_channel.h \
- red_client.cpp \
- red_client.h \
- red_drawable.h \
- red_key.h \
- red_peer.cpp \
- red_peer.h \
- red_pixmap.h \
- red_pixmap_sw.h \
- red_sw_canvas.cpp \
- red_sw_canvas.h \
- red_types.h \
- red_window.h \
- screen.cpp \
- screen.h \
- screen_layer.cpp \
- screen_layer.h \
- shared_cache.hpp \
- threads.cpp \
- threads.h \
- utils.cpp \
- utils.h \
- zlib_decoder.cpp \
- zlib_decoder.h \
- $(BUILT_SOURCES) \
- $(NULL)
-
-if OS_WIN32
-spicec_SOURCES += \
- red_gdi_canvas.cpp \
- red_gdi_canvas.h \
- red_pixmap_gdi.h \
- windows/atomic_count.h \
- windows/event_sources_p.cpp \
- windows/main.cpp \
- windows/my_getopt.cpp \
- windows/named_pipe.cpp \
- windows/named_pipe.h \
- windows/pixels_source.cpp \
- windows/pixels_source_p.h \
- windows/platform.cpp \
- windows/platform_utils.cpp \
- windows/platform_utils.h \
- windows/playback.cpp \
- windows/playback.h \
- windows/record.cpp \
- windows/record.h \
- windows/red_drawable.cpp \
- windows/red_pixmap.cpp \
- windows/red_pixmap_gdi.cpp \
- windows/red_pixmap_sw.cpp \
- windows/red_window.cpp \
- windows/red_window_p.h \
- windows/resource.h \
- windows/stdint.h \
- windows/win_platform.h \
- $(NULL)
-
-spicec_resource_LDADD = windows/redc.o
-
-windows/redc.o: windows/redc.rc
- $(WINDRES) $< -o $@
-else
-spicec_SOURCES += \
- x11/atomic_count.h \
- x11/event_sources_p.cpp \
- x11/event_sources_p.h \
- x11/main.cpp \
- x11/named_pipe.cpp \
- x11/named_pipe.h \
- x11/pixels_source.cpp \
- x11/pixels_source_p.h \
- x11/platform.cpp \
- x11/platform_utils.cpp \
- x11/platform_utils.h \
- x11/playback.cpp \
- x11/playback.h \
- x11/record.cpp \
- x11/record.h \
- x11/red_drawable.cpp \
- x11/red_pixmap.cpp \
- x11/red_pixmap_sw.cpp \
- x11/red_window.cpp \
- x11/red_window_p.h \
- x11/res.cpp \
- x11/res.h \
- x11/resource.h \
- x11/x_icon.cpp \
- x11/x_icon.h \
- x11/x_platform.h \
- $(NULL)
-endif
-
-if OS_WIN32
-PLATFORM_INCLUDES=-I$(top_srcdir)/client/windows
-else
-PLATFORM_INCLUDES=-I$(top_srcdir)/client/x11
-endif
-
-if SUPPORT_GUI
-spicec_SOURCES += \
- gui/gui.cpp \
- gui/gui.h \
- gui/resource_provider.cpp \
- gui/resource_provider.h \
- gui/softrenderer.cpp \
- gui/softrenderer.h \
- gui/softtexture.cpp \
- gui/softtexture.h \
- $(NULL)
-endif
-
-if SUPPORT_GL
-spicec_SOURCES += \
- red_gl_canvas.cpp \
- red_gl_canvas.h \
- red_pixmap_gl.h \
- $(NULL)
-
-if !OS_WIN32
-spicec_SOURCES += x11/red_pixmap_gl.cpp
-endif
-
-endif
-
-if SUPPORT_SMARTCARD
-spicec_SOURCES += \
- smartcard_channel.cpp \
- smartcard_channel.h \
- $(NULL)
-endif
-
-
-AM_CPPFLAGS = \
- -D__STDC_LIMIT_MACROS \
- $(PLATFORM_INCLUDES) \
- -I$(top_srcdir)/spice-common \
- $(ALSA_CFLAGS) \
- $(CEGUI_CFLAGS) \
- $(CEGUI06_CFLAGS) \
- $(CELT051_CFLAGS) \
- $(GL_CFLAGS) \
- $(MISC_X_CFLAGS) \
- $(PIXMAN_CFLAGS) \
- $(COMMON_CFLAGS) \
- $(SPICE_NONPKGCONFIG_CFLAGS) \
- $(SMARTCARD_CFLAGS) \
- $(SSL_CFLAGS) \
- $(XRANDR_CFLAGS) \
- $(XFIXES_CFLAGS) \
- $(WARN_CXXFLAGS) \
- $(XINERAMA_CFLAGS) \
- $(CXIMAGE_CFLAGS) \
- $(NULL)
-
-spicec_LDFLAGS = $(SPICEC_STATIC_LINKAGE_BSTATIC)
-
-spicec_LDADD = \
- $(top_builddir)/spice-common/common/libspice-common.la \
- $(top_builddir)/spice-common/common/libspice-common-client.la \
- $(ALSA_LIBS) \
- $(CEGUI_LIBS) \
- $(CEGUI06_LIBS) \
- $(CELT051_LIBS) \
- $(GL_LIBS) \
- $(JPEG_LIBS) \
- $(MISC_X_LIBS) \
- $(PIXMAN_LIBS) \
- $(SMARTCARD_LIBS) \
- $(SPICE_NONPKGCONFIG_LIBS) \
- $(SSL_LIBS) \
- $(XFIXES_LIBS) \
- $(XRANDR_LIBS) \
- $(Z_LIBS) \
- $(XINERAMA_LIBS) \
- $(spicec_resource_LDADD) \
- $(NULL)
-
-EXTRA_DIST = \
- glz_decode_tmpl.c \
- x11/images/red_icon.c \
- x11/images/alt_image.c \
- gui/commonv2c.ttf.c \
- gui/commonwealth-10.font.c \
- gui/dejavu_sans-10.font.c \
- gui/dejavu_sans.ttf.c \
- gui/taharez_look.imageset.c \
- gui/taharez_look.looknfeel.c \
- gui/taharez_look.scheme.c \
- gui/taharez_look.tga.c \
- $(NULL)
diff --git a/client/application.cpp b/client/application.cpp
deleted file mode 100644
index cdce86d7..00000000
--- a/client/application.cpp
+++ /dev/null
@@ -1,2685 +0,0 @@
-/*
- Copyright (C) 2009 Red Hat, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, see .
-*/
-#ifdef HAVE_CONFIG_H
-#include
-#endif
-
-#include "common.h"
-#ifdef WIN32
-#include
-#endif
-
-#include "common/quic.h"
-#include "common/mutex.h"
-#include "common/rect.h"
-
-#include "application.h"
-#include "screen.h"
-#include "utils.h"
-#include "debug.h"
-#include "screen_layer.h"
-#include "monitor.h"
-#include "resource.h"
-#ifdef WIN32
-#include "red_gdi_canvas.h"
-#endif
-#include "platform.h"
-#include "red_sw_canvas.h"
-#ifdef USE_OPENGL
-#include "red_gl_canvas.h"
-#endif
-#include "cmd_line_parser.h"
-#ifdef USE_GUI
-#include "gui/gui.h"
-#endif
-#include
-#include
-#include
-#include
-
-#ifdef USE_SMARTCARD
-#include
-#endif
-
-#define STICKY_KEY_PIXMAP ALT_IMAGE_RES_ID
-#define STICKY_KEY_TIMEOUT 750
-
-#define CA_FILE_NAME "spice_truststore.pem"
-
-static const char* app_name = "spicec";
-
-void ConnectedEvent::response(AbstractProcessLoop& events_loop)
-{
- static_cast(events_loop.get_owner())->on_connected();
-}
-
-void DisconnectedEvent::response(AbstractProcessLoop& events_loop)
-{
- Application* app = static_cast(events_loop.get_owner());
- app->on_disconnected(_error_code);
-}
-
-void VisibilityEvent::response(AbstractProcessLoop& events_loop)
-{
- Application* app = static_cast(events_loop.get_owner());
- app->on_visibility_start(_screen_id);
-}
-
-void MonitorsQuery::do_response(AbstractProcessLoop& events_loop)
-{
- Monitor* mon;
- int i = 0;
-
- while ((mon = (static_cast(events_loop.get_owner()))->find_monitor(i++))) {
- MonitorInfo info;
- info.size = mon->get_size();
- info.depth = 32;
- info.position = mon->get_position();
- _monitors.push_back(info);
- }
-}
-
-SwitchHostEvent::SwitchHostEvent(const char* host, int port, int sport, const char* cert_subject)
-{
- _host = host;
- _port = port;
- _sport = sport;
- if (cert_subject) {
- _cert_subject = cert_subject;
- }
-}
-
-void SwitchHostEvent::response(AbstractProcessLoop& events_loop)
-{
- Application* app = static_cast(events_loop.get_owner());
- app->switch_host(_host, _port, _sport, _cert_subject);
-}
-
-#ifdef USE_GUI
-//todo: add inactive visual appearance
-class GUIBarrier: public ScreenLayer {
-public:
- GUIBarrier(int id)
- : ScreenLayer(SCREEN_LAYER_GUI_BARIER, true)
- , _id (id)
- , _cursor (Platform::create_inactive_cursor())
- {
- }
-
- ~GUIBarrier()
- {
- detach();
- }
-
- int get_id() { return _id;}
-
- void attach(RedScreen& in_screen)
- {
- if (screen()) {
- ASSERT(&in_screen == screen())
- return;
- }
- in_screen.attach_layer(*this);
- }
-
- void detach()
- {
- if (!screen()) {
- return;
- }
- screen()->detach_layer(*this);
- }
-
- virtual bool pointer_test(int x, int y) { return true;}
- virtual void on_pointer_enter(int x, int y, unsigned int buttons_state)
- {
- AutoRef cursor(Platform::create_inactive_cursor());
- screen()->set_cursor(*cursor);
- return;
- }
-
-private:
- int _id;
- AutoRef _cursor;
-};
-
-class GUITimer: public Timer {
-public:
- GUITimer(GUI& gui)
- : _gui (gui)
- {
- }
-
- virtual void response(AbstractProcessLoop& events_loop)
- {
- _gui.idle();
- }
-
-private:
- GUI& _gui;
-};
-
-
-#ifdef GUI_DEMO
-class TestTimer: public Timer {
-public:
- TestTimer(Application& app)
- : _app (app)
- {
- }
-
- virtual void response(AbstractProcessLoop& events_loop)
- {
- _app.message_box_test();
- }
-
-private:
- Application& _app;
-};
-#endif
-
-#endif // USE_GUI
-
-class InfoLayer: public ScreenLayer {
-public:
- InfoLayer();
-
- virtual void copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc);
-
- void set_info_mode();
- void set_sticky(bool is_on);
- virtual void on_size_changed();
-
-private:
- void draw_info(const QRegion& dest_region, RedDrawable& dest);
- void update_sticky_rect();
-
-private:
- AlphaImageFromRes _sticky_pixmap;
- SpicePoint _sticky_pos;
- SpiceRect _sticky_rect;
- bool _sticky_on;
- RecurciveMutex _update_lock;
-};
-
-InfoLayer::InfoLayer()
- : ScreenLayer(SCREEN_LAYER_INFO, false)
- , _sticky_pixmap (STICKY_KEY_PIXMAP)
- , _sticky_on (false)
-{
-}
-
-void InfoLayer::draw_info(const QRegion& dest_region, RedDrawable& dest)
-{
- pixman_box32_t *rects;
- int num_rects;
-
- rects = pixman_region32_rectangles((pixman_region32_t *)&dest_region, &num_rects);
- for (int i = 0; i < num_rects; i++) {
- SpiceRect r;
-
- r.left = rects[i].x1;
- r.top = rects[i].y1;
- r.right = rects[i].x2;
- r.bottom = rects[i].y2;
-
- /* is rect inside sticky region ? */
- if (_sticky_on && rect_intersects(r, _sticky_rect)) {
- dest.blend_pixels(_sticky_pixmap, r.left - _sticky_pos.x, r.top - _sticky_pos.y, r);
- }
- }
-}
-
-void InfoLayer::copy_pixels(const QRegion& dest_region, RedDrawable& dest_dc)
-{
- RecurciveLock lock(_update_lock);
- draw_info(dest_region, dest_dc);
-}
-
-void InfoLayer::set_info_mode()
-{
- ASSERT(screen());
-
- clear_area();
- update_sticky_rect();
- set_sticky(_sticky_on);
-}
-
-void InfoLayer::update_sticky_rect()
-{
- SpicePoint size = _sticky_pixmap.get_size();
- SpicePoint screen_size = screen()->get_size();
-
- _sticky_pos.x = (screen_size.x - size.x) / 2;
- _sticky_pos.y = screen_size.y * 2 / 3;
- _sticky_rect.left = _sticky_pos.x;
- _sticky_rect.top = _sticky_pos.y;
- _sticky_rect.right = _sticky_rect.left + size.x;
- _sticky_rect.bottom = _sticky_rect.top + size.y;
-}
-
-void InfoLayer::set_sticky(bool is_on)
-{
- RecurciveLock lock(_update_lock);
- if (!_sticky_on && !is_on) {
- return;
- }
-
- _sticky_on = is_on;
-
- if (_sticky_on) {
- add_rect_area(_sticky_rect);
- invalidate(_sticky_rect);
- } else {
- remove_rect_area(_sticky_rect);
- }
-}
-
-void InfoLayer::on_size_changed()
-{
- set_info_mode();
-}
-
-void StickyKeyTimer::response(AbstractProcessLoop& events_loop)
-{
- Application* app = (Application*)events_loop.get_owner();
- StickyInfo* sticky_info = &app->_sticky_info;
- ASSERT(app->is_sticky_trace_key(sticky_info->key));
- ASSERT(app->_keyboard_state[sticky_info->key]);
- ASSERT(sticky_info->key_first_down);
- ASSERT(sticky_info->key_down);
- sticky_info->sticky_mode = true;
- DBG(0, "ON sticky");
- app->_info_layer->set_sticky(true);
- app->deactivate_interval_timer(this);
-}
-
-static MouseHandler default_mouse_handler;
-static KeyHandler default_key_handler;
-
-enum AppCommands {
- APP_CMD_INVALID,
- APP_CMD_SEND_CTL_ALT_DEL,
- APP_CMD_TOGGLE_FULL_SCREEN,
- APP_CMD_RELEASE_CAPTURE,
- APP_CMD_SEND_TOGGLE_KEYS,
- APP_CMD_SEND_RELEASE_KEYS,
- APP_CMD_SEND_CTL_ALT_END,
-#ifdef RED_DEBUG
- APP_CMD_CONNECT,
- APP_CMD_DISCONNECT,
-#endif
-#ifdef USE_GUI
- APP_CMD_SHOW_GUI,
-#endif // USE_GUI
-#ifdef USE_SMARTCARD
- APP_CMD_SMARTCARD_INSERT,
- APP_CMD_SMARTCARD_REMOVE,
-#endif
- APP_CMD_EXTERNAL_BEGIN = 0x400,
- APP_CMD_EXTERNAL_END = 0x800,
-};
-
-Application::Application()
- : ProcessLoop (this)
- , _client (*this)
- , _con_ciphers ("DEFAULT")
- , _enabled_channels (SPICE_END_CHANNEL, true)
- , _main_screen (NULL)
- , _active (false)
- , _full_screen (false)
- , _changing_screens (false)
- , _out_of_sync (false)
- , _exit_code (0)
- , _active_screen (NULL)
- , _num_keys_pressed (0)
- , _info_layer (new InfoLayer())
- , _key_handler (&default_key_handler)
- , _mouse_handler (&default_mouse_handler)
- , _monitors (NULL)
- , _title ("SPICEc:%d")
- , _sys_key_intercept_mode (false)
- , _enable_controller (false)
-#ifdef USE_GUI
- , _gui_mode (GUI_MODE_FULL)
-#endif // USE_GUI
- , _during_host_switch(false)
- , _state (DISCONNECTED)
-#ifdef USE_SMARTCARD
- , _smartcard_options(new SmartcardOptions())
-#endif
-{
- DBG(0, "");
-
- _commands_map["toggle-fullscreen"] = APP_CMD_TOGGLE_FULL_SCREEN;
- _commands_map["release-cursor"] = APP_CMD_RELEASE_CAPTURE;
-#ifdef RED_DEBUG
- _commands_map["connect"] = APP_CMD_CONNECT;
- _commands_map["disconnect"] = APP_CMD_DISCONNECT;
-#endif
-#ifdef USE_GUI
- _commands_map["show-gui"] = APP_CMD_SHOW_GUI;
-#endif // USE_GUI
-#ifdef USE_SMARTCARD
- _commands_map["smartcard-insert"] = APP_CMD_SMARTCARD_INSERT;
- _commands_map["smartcard-remove"] = APP_CMD_SMARTCARD_REMOVE;
-#endif
-
- _canvas_types.resize(1);
-#ifdef WIN32
- _canvas_types[0] = CANVAS_OPTION_GDI;
-#else
- _canvas_types[0] = CANVAS_OPTION_SW;
-#endif
-
- _host_auth_opt.type_flags = SPICE_SSL_VERIFY_OP_HOSTNAME;
-
- Platform::get_app_data_dir(_host_auth_opt.CA_file, app_name);
- Platform::path_append(_host_auth_opt.CA_file, CA_FILE_NAME);
-
- this->set_default_hotkeys();
-
- _sticky_info.trace_is_on = false;
- _sticky_info.sticky_mode = false;
- _sticky_info.key_first_down = false;
- _sticky_info.key_down = false;
- _sticky_info.key = REDKEY_INVALID;
- _sticky_info.timer.reset(new StickyKeyTimer());
-
- for (int i = SPICE_CHANNEL_MAIN; i < SPICE_END_CHANNEL; i++) {
- _peer_con_opt[i] = RedPeer::ConnectionOptions::CON_OP_BOTH;
- }
- memset(_keyboard_state, 0, sizeof(_keyboard_state));
-}
-
-Application::~Application()
-{
-#ifdef USE_GUI
- if (*_gui_timer != NULL) {
- deactivate_interval_timer(*_gui_timer);
- }
-#ifdef GUI_DEMO
- if (*_gui_test_timer != NULL) {
- deactivate_interval_timer(*_gui_test_timer);
- }
-#endif
- destroyed_gui_barriers();
- if (_gui.get() != NULL) {
- _gui->set_screen(NULL);
- }
-#endif // USE_GUI
-
- if (_info_layer->screen()) {
- _main_screen->detach_layer(*_info_layer);
- }
-
- if (_main_screen != NULL) {
- _main_screen->unref();
- destroy_monitors();
- }
-#ifdef USE_SMARTCARD
- delete _smartcard_options;
-#endif
-}
-
-void Application::init_menu()
-{
- //fixme: menu items name need to be dynamically updated by hot keys configuration.
- AutoRef