summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-21 14:42:35 +0100
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-03-25 18:59:10 +0200
commit359fc1cb5dbbcf32132c3e8ee6f881a23deff684 (patch)
tree3ae7cc1c8b4d0449d50a13cb9640a6ef75f51f11 /client
parent4df135c858d7dfb1aa0ae5d3cb17d786410d1544 (diff)
downloadspice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.tar.gz
spice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.tar.xz
spice-359fc1cb5dbbcf32132c3e8ee6f881a23deff684.zip
Use the spice-common submodule
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
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am62
-rw-r--r--client/application.cpp7
-rw-r--r--client/canvas.h10
-rw-r--r--client/cursor.h2
-rw-r--r--client/cursor_channel.cpp3
-rw-r--r--client/demarshallers.h27
-rw-r--r--client/display_channel.cpp1
-rw-r--r--client/display_channel.h3
-rw-r--r--client/glz_decoder.h2
-rw-r--r--client/glz_decoder_config.h4
-rw-r--r--client/jpeg_decoder.h5
-rw-r--r--client/marshallers.h63
-rw-r--r--client/monitor.h2
-rw-r--r--client/pixels_source.h2
-rw-r--r--client/red_canvas_base.h2
-rw-r--r--client/red_channel.h5
-rw-r--r--client/red_client.cpp7
-rw-r--r--client/red_client.h2
-rw-r--r--client/red_drawable.h2
-rw-r--r--client/red_gdi_canvas.cpp18
-rw-r--r--client/red_gdi_canvas.h2
-rw-r--r--client/red_gl_canvas.cpp15
-rw-r--r--client/red_gl_canvas.h4
-rw-r--r--client/red_peer.cpp8
-rw-r--r--client/red_peer.h7
-rw-r--r--client/red_sw_canvas.cpp20
-rw-r--r--client/red_sw_canvas.h2
-rw-r--r--client/screen.h3
-rw-r--r--client/screen_layer.h2
-rw-r--r--client/smartcard_channel.cpp2
-rw-r--r--client/x11/pixels_source_p.h3
-rw-r--r--client/x11/platform.cpp5
-rw-r--r--client/x11/red_drawable.cpp2
-rw-r--r--client/x11/red_pixmap_gl.cpp2
-rw-r--r--client/x11/red_window.cpp15
35 files changed, 118 insertions, 203 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index c4b5fe1f..4913c1ee 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -2,27 +2,6 @@ NULL =
bin_PROGRAMS = spicec
-BUILT_SOURCES = \
- generated_demarshallers.cpp \
- generated_marshallers.cpp \
- generated_demarshallers1.cpp \
- generated_marshallers1.cpp \
- $(NULL)
-
-generated_demarshallers.cpp: $(top_srcdir)/spice.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common.h --include messages.h $(top_srcdir)/spice.proto generated_demarshallers.cpp
-
-generated_demarshallers1.cpp: $(top_srcdir)/spice1.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include common.h --include messages.h --prefix 1 --ptrsize 8 $(top_srcdir)/spice1.proto generated_demarshallers1.cpp
-
-generated_marshallers.cpp: $(top_srcdir)/spice.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include "common.h" --include messages.h --include marshallers.h --client $(top_srcdir)/spice.proto generated_marshallers.cpp
-
-generated_marshallers1.cpp: $(top_srcdir)/spice1.proto
- $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include "common.h" --include messages.h --include marshallers.h --client --prefix 1 --ptrsize 8 $(top_srcdir)/spice1.proto generated_marshallers1.cpp
-
-MAINTAINERCLEANFILES = $(BUILT_SOURCES)
-
spicec_SOURCES = \
application.cpp \
application.h \
@@ -43,7 +22,6 @@ spicec_SOURCES = \
cursor_channel.cpp \
cursor_channel.h \
debug.h \
- demarshallers.h \
display_channel.cpp \
display_channel.h \
event_sources.h \
@@ -63,7 +41,6 @@ spicec_SOURCES = \
inputs_handler.h \
jpeg_decoder.cpp \
jpeg_decoder.h \
- marshallers.h \
menu.cpp \
menu.h \
mjpeg_decoder.cpp \
@@ -230,7 +207,7 @@ INCLUDES = \
$(GL_CFLAGS) \
$(MISC_X_CFLAGS) \
$(PIXMAN_CFLAGS) \
- $(PROTOCOL_CFLAGS) \
+ $(COMMON_CFLAGS) \
$(SPICE_NONPKGCONFIG_CFLAGS) \
$(SMARTCARD_CFLAGS) \
$(SSL_CFLAGS) \
@@ -243,24 +220,25 @@ INCLUDES = \
spicec_LDFLAGS = $(SPICEC_STATIC_LINKAGE_BSTATIC)
-spicec_LDADD = \
- $(top_builddir)/common/libspice-common.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) \
+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 = \
diff --git a/client/application.cpp b/client/application.cpp
index 34ef729f..43fe7fa7 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -23,6 +23,10 @@
#include <io.h>
#endif
+#include "common/quic.h"
+#include "common/mutex.h"
+#include "common/rect.h"
+
#include "application.h"
#include "screen.h"
#include "utils.h"
@@ -38,13 +42,10 @@
#ifdef USE_OPENGL
#include "red_gl_canvas.h"
#endif
-#include "quic.h"
-#include "mutex.h"
#include "cmd_line_parser.h"
#ifdef USE_TUNNEL
#include "tunnel_channel.h"
#endif
-#include "rect.h"
#ifdef USE_GUI
#include "gui/gui.h"
#endif
diff --git a/client/canvas.h b/client/canvas.h
index 51f28003..cd6a89b9 100644
--- a/client/canvas.h
+++ b/client/canvas.h
@@ -19,18 +19,20 @@
#ifndef _H_CANVAS
#define _H_CANVAS
+#include <map>
+
+#include "common/region.h"
+#include "common/messages.h"
+#include "common/canvas_utils.h"
+
#include "common.h"
#include "debug.h"
-#include "region.h"
-#include "messages.h"
#include "cache.hpp"
#include "shared_cache.hpp"
-#include "canvas_utils.h"
#include "glz_decoded_image.h"
#include "glz_decoder.h"
#include "jpeg_decoder.h"
#include "zlib_decoder.h"
-#include <map>
enum CanvasType {
CANVAS_TYPE_INVALID,
diff --git a/client/cursor.h b/client/cursor.h
index 16b7fc52..3210f1e9 100644
--- a/client/cursor.h
+++ b/client/cursor.h
@@ -18,8 +18,8 @@
#ifndef _H_CURSOR_
#define _H_CURSOR_
+#include "common/messages.h"
#include "threads.h"
-#include "messages.h"
#include "red_window_p.h"
class CursorOpaque {
diff --git a/client/cursor_channel.cpp b/client/cursor_channel.cpp
index e317dfa2..48786e38 100644
--- a/client/cursor_channel.cpp
+++ b/client/cursor_channel.cpp
@@ -18,6 +18,8 @@
#include <config.h>
#endif
+#include "common/rect.h"
+
#include "common.h"
#include "cursor_channel.h"
#include "display_channel.h"
@@ -28,7 +30,6 @@
#include "utils.h"
#include "screen.h"
#include "red_pixmap_sw.h"
-#include "rect.h"
static inline uint8_t revers_bits(uint8_t byte)
{
diff --git a/client/demarshallers.h b/client/demarshallers.h
deleted file mode 100644
index 90084cf2..00000000
--- a/client/demarshallers.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
-*/
-#ifndef _H_DEMARSHAL
-#define _H_DEMARSHAL
-
-typedef void (*message_destructor_t)(uint8_t *message);
-typedef uint8_t * (*spice_parse_channel_func_t)(uint8_t *message_start, uint8_t *message_end, uint16_t message_type, int minor,
- size_t *size_out, message_destructor_t *free_message);
-
-spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t channel, unsigned int *max_message_type);
-spice_parse_channel_func_t spice_get_server_channel_parser1(uint32_t channel, unsigned int *max_message_type);
-
-#endif
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 173f012e..ebeacd2c 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -20,7 +20,6 @@
#endif
#include "common.h"
-#include "canvas.h"
#include "red_pixmap.h"
#ifdef USE_OPENGL
#include "red_pixmap_gl.h"
diff --git a/client/display_channel.h b/client/display_channel.h
index 7cdd55c8..72856f59 100644
--- a/client/display_channel.h
+++ b/client/display_channel.h
@@ -19,9 +19,10 @@
#ifndef _H_DISPLAY_CHANNEL
#define _H_DISPLAY_CHANNEL
+#include "common/region.h"
+
#include "common.h"
#include "canvas.h"
-#include "region.h"
#include "red_channel.h"
#include "cache.hpp"
#include "screen_layer.h"
diff --git a/client/glz_decoder.h b/client/glz_decoder.h
index a0352cc1..0d505fdb 100644
--- a/client/glz_decoder.h
+++ b/client/glz_decoder.h
@@ -19,7 +19,7 @@
#ifndef _H_GLZ_DECODER
#define _H_GLZ_DECODER
-#include "lz_common.h"
+#include "common/lz_common.h"
#include "glz_decoder_config.h"
#include "glz_decoder_window.h"
#include "red_canvas_base.h"
diff --git a/client/glz_decoder_config.h b/client/glz_decoder_config.h
index 52fa52d3..c15f012b 100644
--- a/client/glz_decoder_config.h
+++ b/client/glz_decoder_config.h
@@ -20,13 +20,11 @@
#include <exception>
#include <sstream>
-
-#include "lz_common.h"
-
#include <stdio.h>
#include <spice/types.h>
#include <spice/macros.h>
+#include "common/lz_common.h"
class GlzException: public std::exception {
public:
diff --git a/client/jpeg_decoder.h b/client/jpeg_decoder.h
index 8f7e1bb8..ae76f504 100644
--- a/client/jpeg_decoder.h
+++ b/client/jpeg_decoder.h
@@ -30,6 +30,11 @@
extern "C" {
#include <jpeglib.h>
+#ifdef HAVE_STDLIB_H
+/* on mingw, there is a hack,
+ and we also include config.h from spice-common, which redefine it */
+#undef HAVE_STDLIB_H
+#endif
}
class RGBConverter {
diff --git a/client/marshallers.h b/client/marshallers.h
deleted file mode 100644
index 47faefff..00000000
--- a/client/marshallers.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
- Copyright (C) 2010 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 <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _H_MARSHALLERS
-#define _H_MARSHALLERS
-
-#include <spice/protocol.h>
-#include <marshaller.h>
-#include <messages.h>
-
-typedef struct {
- void (*msg_SpiceMsgEmpty)(SpiceMarshaller *m, SpiceMsgEmpty *msg);
- void (*msg_SpiceMsgData)(SpiceMarshaller *m, SpiceMsgData *msg);
- void (*msg_SpiceMsgAudioVolume)(SpiceMarshaller *m, SpiceMsgAudioVolume *msg);
- void (*msg_SpiceMsgAudioMute)(SpiceMarshaller *m, SpiceMsgAudioMute *msg);
- void (*msgc_ack_sync)(SpiceMarshaller *m, SpiceMsgcAckSync *msg);
- void (*msgc_pong)(SpiceMarshaller *m, SpiceMsgPing *msg);
- void (*msgc_disconnecting)(SpiceMarshaller *m, SpiceMsgDisconnect *msg);
- void (*msgc_main_client_info)(SpiceMarshaller *m, SpiceMsgcClientInfo *msg);
- void (*msgc_main_mouse_mode_request)(SpiceMarshaller *m, SpiceMsgcMainMouseModeRequest *msg);
- void (*msgc_main_agent_start)(SpiceMarshaller *m, SpiceMsgcMainAgentStart *msg);
- void (*msgc_main_agent_token)(SpiceMarshaller *m, SpiceMsgcMainAgentTokens *msg);
- void (*msgc_display_init)(SpiceMarshaller *m, SpiceMsgcDisplayInit *msg);
- void (*msgc_inputs_key_down)(SpiceMarshaller *m, SpiceMsgcKeyDown *msg);
- void (*msgc_inputs_key_up)(SpiceMarshaller *m, SpiceMsgcKeyUp *msg);
- void (*msgc_inputs_key_modifiers)(SpiceMarshaller *m, SpiceMsgcKeyModifiers *msg);
- void (*msgc_inputs_mouse_motion)(SpiceMarshaller *m, SpiceMsgcMouseMotion *msg);
- void (*msgc_inputs_mouse_position)(SpiceMarshaller *m, SpiceMsgcMousePosition *msg);
- void (*msgc_inputs_mouse_press)(SpiceMarshaller *m, SpiceMsgcMousePress *msg);
- void (*msgc_inputs_mouse_release)(SpiceMarshaller *m, SpiceMsgcMouseRelease *msg);
- void (*msgc_record_data)(SpiceMarshaller *m, SpiceMsgcRecordPacket *msg);
- void (*msgc_record_mode)(SpiceMarshaller *m, SpiceMsgcRecordMode *msg);
- void (*msgc_record_start_mark)(SpiceMarshaller *m, SpiceMsgcRecordStartMark *msg);
- void (*msgc_tunnel_service_add)(SpiceMarshaller *m, SpiceMsgcTunnelAddGenericService *msg, SpiceMarshaller **name_out, SpiceMarshaller **description_out);
- void (*msgc_tunnel_service_remove)(SpiceMarshaller *m, SpiceMsgcTunnelRemoveService *msg);
- void (*msgc_tunnel_socket_open_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenAck *msg);
- void (*msgc_tunnel_socket_open_nack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketOpenNack *msg);
- void (*msgc_tunnel_socket_fin)(SpiceMarshaller *m, SpiceMsgcTunnelSocketFin *msg);
- void (*msgc_tunnel_socket_closed)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosed *msg);
- void (*msgc_tunnel_socket_closed_ack)(SpiceMarshaller *m, SpiceMsgcTunnelSocketClosedAck *msg);
- void (*msgc_tunnel_socket_data)(SpiceMarshaller *m, SpiceMsgcTunnelSocketData *msg);
- void (*msgc_tunnel_socket_token)(SpiceMarshaller *m, SpiceMsgcTunnelSocketTokens *msg);
-} SpiceMessageMarshallers;
-
-SpiceMessageMarshallers *spice_message_marshallers_get(void);
-SpiceMessageMarshallers *spice_message_marshallers_get1(void);
-
-#endif
diff --git a/client/monitor.h b/client/monitor.h
index b8d7c88b..bbaaf17c 100644
--- a/client/monitor.h
+++ b/client/monitor.h
@@ -18,7 +18,7 @@
#ifndef _H_MONITOR
#define _H_MONITOR
-#include "draw.h"
+#include "common/draw.h"
class Monitor {
public:
diff --git a/client/pixels_source.h b/client/pixels_source.h
index 1f4d1965..55841a65 100644
--- a/client/pixels_source.h
+++ b/client/pixels_source.h
@@ -18,7 +18,7 @@
#ifndef _H_PIXELS_SOURCE
#define _H_PIXELS_SOURCE
-#include "draw.h"
+#include "common/draw.h"
#define PIXELES_SOURCE_OPAQUE_SIZE (20 * sizeof(void*))
diff --git a/client/red_canvas_base.h b/client/red_canvas_base.h
index bd59109c..15060552 100644
--- a/client/red_canvas_base.h
+++ b/client/red_canvas_base.h
@@ -19,7 +19,7 @@
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "canvas_base.h"
+#include "common/canvas_base.h"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/client/red_channel.h b/client/red_channel.h
index a8390214..3cf51602 100644
--- a/client/red_channel.h
+++ b/client/red_channel.h
@@ -18,14 +18,15 @@
#ifndef _H_REDCHANNEL
#define _H_REDCHANNEL
+#include "common/client_demarshallers.h"
+#include "common/client_marshallers.h"
+
#include "common.h"
#include "utils.h"
#include "threads.h"
#include "red_peer.h"
#include "platform.h"
#include "process_loop.h"
-#include "demarshallers.h"
-#include "marshallers.h"
enum {
PASSIVE_STATE,
diff --git a/client/red_client.cpp b/client/red_client.cpp
index 04544083..8f86d3ef 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -18,15 +18,16 @@
#include <config.h>
#endif
-#include "common.h"
+#include <algorithm>
#include <math.h>
+#include "common/client_marshallers.h"
+
+#include "common.h"
#include "red_client.h"
#include "application.h"
#include "process_loop.h"
#include "utils.h"
#include "debug.h"
-#include "marshallers.h"
-#include <algorithm>
#ifndef INFINITY
#define INFINITY HUGE
diff --git a/client/red_client.h b/client/red_client.h
index 577ccb7a..a2f00c41 100644
--- a/client/red_client.h
+++ b/client/red_client.h
@@ -19,6 +19,7 @@
#define _H_REDCLIENT
#include <list>
+#include "common/messages.h"
#include "common.h"
#include "red_peer.h"
@@ -27,7 +28,6 @@
#include "inputs_channel.h"
#include "cursor_channel.h"
#include "audio_channels.h"
-#include "messages.h"
#include <spice/vd_agent.h>
#include "process_loop.h"
diff --git a/client/red_drawable.h b/client/red_drawable.h
index 660ff4e8..8ad3d4c4 100644
--- a/client/red_drawable.h
+++ b/client/red_drawable.h
@@ -18,7 +18,7 @@
#ifndef _H_RED_DRAWABLE
#define _H_RED_DRAWABLE
-#include <pixman_utils.h>
+#include "common/pixman_utils.h"
#include "pixels_source.h"
#include "utils.h"
diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp
index 2e42510a..09a15532 100644
--- a/client/red_gdi_canvas.cpp
+++ b/client/red_gdi_canvas.cpp
@@ -21,20 +21,24 @@
#include <config.h>
#endif
-#include "common.h"
+#ifdef WIN32
+#include <winsock2.h>
+#endif
#include <stdint.h>
-#include "red_gdi_canvas.h"
-#include "utils.h"
-#include "debug.h"
-#include "region.h"
-#include "red_pixmap_gdi.h"
+#include "common/region.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "gdi_canvas.c"
+#include "common/gdi_canvas.c"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
+#include "common.h"
+#include "red_gdi_canvas.h"
+#include "utils.h"
+#include "debug.h"
+#include "red_pixmap_gdi.h"
+
GDICanvas::GDICanvas(int width, int height, uint32_t format,
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
GlzDecoderWindow &glz_decoder_window, SurfacesCache &csurfaces)
diff --git a/client/red_gdi_canvas.h b/client/red_gdi_canvas.h
index 77adcf7b..dbebe331 100644
--- a/client/red_gdi_canvas.h
+++ b/client/red_gdi_canvas.h
@@ -21,7 +21,7 @@
#include "canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "gdi_canvas.h"
+#include "common/gdi_canvas.h"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
#include "red_pixmap_gdi.h"
diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp
index 59c8f06b..81203d99 100644
--- a/client/red_gl_canvas.cpp
+++ b/client/red_gl_canvas.cpp
@@ -18,21 +18,22 @@
#include <config.h>
#endif
-#include "common.h"
#include <stdint.h>
-#include "red_gl_canvas.h"
-#include "utils.h"
-#include "debug.h"
-#include "region.h"
-#include "red_pixmap_gl.h"
#include <GL/glx.h>
+#include "common/region.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "gl_canvas.c"
+#include "common/gl_canvas.c"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
+#include "common.h"
+#include "red_gl_canvas.h"
+#include "utils.h"
+#include "debug.h"
+#include "red_pixmap_gl.h"
+
GCanvas::GCanvas(int width, int height, uint32_t format, RedWindow *win,
RenderType rendertype,
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
diff --git a/client/red_gl_canvas.h b/client/red_gl_canvas.h
index a57ea480..e78b1cc8 100644
--- a/client/red_gl_canvas.h
+++ b/client/red_gl_canvas.h
@@ -21,8 +21,8 @@
#include "canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "sw_canvas.h"
-#include "gl_canvas.h"
+#include "common/sw_canvas.h"
+#include "common/gl_canvas.h"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/client/red_peer.cpp b/client/red_peer.cpp
index 17fcb456..64e43d5b 100644
--- a/client/red_peer.cpp
+++ b/client/red_peer.cpp
@@ -19,15 +19,19 @@
#include <config.h>
#endif
-#include "common.h"
+#ifdef WIN32
+#include <winsock2.h>
+#endif
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <spice/protocol.h>
+#include "common/ssl_verify.h"
+
+#include "common.h"
#include "red_peer.h"
#include "utils.h"
#include "debug.h"
#include "platform_utils.h"
-#include "ssl_verify.h"
static void ssl_error()
{
diff --git a/client/red_peer.h b/client/red_peer.h
index 5e2b2b91..b0faa9d7 100644
--- a/client/red_peer.h
+++ b/client/red_peer.h
@@ -21,14 +21,15 @@
#include <openssl/ssl.h>
#include <openssl/err.h>
-#include "common.h"
#include <spice/protocol.h>
+#include "common/marshaller.h"
+#include "common/ssl_verify.h"
+
+#include "common.h"
#include "process_loop.h"
#include "threads.h"
#include "platform_utils.h"
-#include "marshaller.h"
#include "debug.h"
-#include "ssl_verify.h"
class RedPeer: protected EventSources::Socket {
public:
diff --git a/client/red_sw_canvas.cpp b/client/red_sw_canvas.cpp
index 5f86dca1..d18af0f9 100644
--- a/client/red_sw_canvas.cpp
+++ b/client/red_sw_canvas.cpp
@@ -19,21 +19,25 @@
#include <config.h>
#endif
-#include "common.h"
#include <stdint.h>
-#include "red_window.h"
-#include "red_sw_canvas.h"
-#include "utils.h"
-#include "debug.h"
-#include "region.h"
-#include "red_pixmap_sw.h"
+#ifdef WIN32
+#include <winsock2.h>
+#endif
+#include "common/region.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "sw_canvas.c"
+#include "common/sw_canvas.c"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
+#include "common.h"
+#include "red_window.h"
+#include "red_sw_canvas.h"
+#include "utils.h"
+#include "debug.h"
+#include "red_pixmap_sw.h"
+
SCanvas::SCanvas(bool onscreen,
int width, int height, uint32_t format, RedWindow *win,
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
diff --git a/client/red_sw_canvas.h b/client/red_sw_canvas.h
index eb577aca..a192c47b 100644
--- a/client/red_sw_canvas.h
+++ b/client/red_sw_canvas.h
@@ -22,7 +22,7 @@
#include "canvas.h"
#define SPICE_CANVAS_INTERNAL
#define SW_CANVAS_CACHE
-#include "sw_canvas.h"
+#include "common/sw_canvas.h"
#undef SW_CANVAS_CACHE
#undef SPICE_CANVAS_INTERNAL
diff --git a/client/screen.h b/client/screen.h
index d7bb4c27..4093006f 100644
--- a/client/screen.h
+++ b/client/screen.h
@@ -18,8 +18,9 @@
#ifndef _H_SCREEN
#define _H_SCREEN
+#include "common/region.h"
+
#include "common.h"
-#include "region.h"
#include "red_key.h"
#ifdef USE_OPENGL
#include "GL/gl.h"
diff --git a/client/screen_layer.h b/client/screen_layer.h
index e8ad4217..1168b245 100644
--- a/client/screen_layer.h
+++ b/client/screen_layer.h
@@ -18,8 +18,8 @@
#ifndef _H_SCREEN_LAYER
#define _H_SCREEN_LAYER
+#include "common/region.h"
#include "threads.h"
-#include "region.h"
class RedScreen;
class Application;
diff --git a/client/smartcard_channel.cpp b/client/smartcard_channel.cpp
index 09659c21..720b879f 100644
--- a/client/smartcard_channel.cpp
+++ b/client/smartcard_channel.cpp
@@ -19,9 +19,9 @@
#endif
#include <spice/enums.h>
+#include "common/mutex.h"
#include "red_client.h"
-#include "mutex.h"
extern "C" {
#include <vscard_common.h>
diff --git a/client/x11/pixels_source_p.h b/client/x11/pixels_source_p.h
index 000fe4d0..64b0c50e 100644
--- a/client/x11/pixels_source_p.h
+++ b/client/x11/pixels_source_p.h
@@ -29,7 +29,8 @@
#ifdef USE_OPENGL
#include "red_pixmap_gl.h"
#endif // USE_OPENGL
-#include "pixman_utils.h"
+
+#include "common/pixman_utils.h"
enum {
PIXELS_SOURCE_TYPE_INVALID,
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index f535d6da..f35d5374 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -48,20 +48,21 @@
#include <sys/time.h>
#endif
+#include <spice/vd_agent.h>
+#include "common/rect.h"
+
#include "platform.h"
#include "application.h"
#include "utils.h"
#include "x_platform.h"
#include "debug.h"
#include "monitor.h"
-#include "rect.h"
#include "record.h"
#include "playback.h"
#include "resource.h"
#include "res.h"
#include "cursor.h"
#include "process_loop.h"
-#include <spice/vd_agent.h>
#define DWORD uint32_t
#define BOOL bool
diff --git a/client/x11/red_drawable.cpp b/client/x11/red_drawable.cpp
index fd5d4a16..bb8ceb44 100644
--- a/client/x11/red_drawable.cpp
+++ b/client/x11/red_drawable.cpp
@@ -26,7 +26,7 @@
#include "utils.h"
#ifdef USE_OPENGL
-#include "gl_utils.h"
+#include "common/gl_utils.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glext.h>
diff --git a/client/x11/red_pixmap_gl.cpp b/client/x11/red_pixmap_gl.cpp
index 1e1e6e0f..8d81c31a 100644
--- a/client/x11/red_pixmap_gl.cpp
+++ b/client/x11/red_pixmap_gl.cpp
@@ -22,12 +22,12 @@
#include <GL/glu.h>
#include <GL/glext.h>
#include <X11/Xlib.h>
+#include "common/gl_utils.h"
#include "common.h"
#include "red_pixmap_gl.h"
#include "debug.h"
#include "utils.h"
-#include "gl_utils.h"
#include "pixels_source_p.h"
#include "x_platform.h"
#include "red_window_p.h"
diff --git a/client/x11/red_window.cpp b/client/x11/red_window.cpp
index fda90d59..83144a54 100644
--- a/client/x11/red_window.cpp
+++ b/client/x11/red_window.cpp
@@ -33,21 +33,22 @@
#endif // USE_OPENGL
#include <stdio.h>
+#include <spice/protocol.h>
+#include "common/region.h"
+
+#ifdef USE_OPENGL
+#include "common/gl_utils.h"
+#include "red_pixmap_gl.h"
+#endif // USE_OPENGL
+
#include "red_window.h"
#include "utils.h"
#include "debug.h"
#include "platform.h"
#include "x_platform.h"
#include "pixels_source_p.h"
-#include <spice/protocol.h>
-#include "region.h"
-#ifdef USE_OPENGL
-#include "gl_utils.h"
-#include "red_pixmap_gl.h"
-#endif // USE_OPENGL
#include "x_icon.h"
-
#define X_RETRIES 10
#define X_RETRY_DELAY_MICRO (1000 * 100)
#define RAISE_RETRIES X_RETRIES