summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2011-04-20 17:50:22 +0200
committerChristophe Fergeau <cfergeau@redhat.com>2011-05-03 14:44:10 +0200
commit2db7212175c51f4121790bfd1fd677c0b77833d5 (patch)
tree8511c736d8a6ca3c0adc43059ff47cdc53f9a980 /client
parent253aa0c960ccb3fd2cd6f6b2550ef09b9cbd5d1a (diff)
downloadspice-2db7212175c51f4121790bfd1fd677c0b77833d5.tar.gz
spice-2db7212175c51f4121790bfd1fd677c0b77833d5.tar.xz
spice-2db7212175c51f4121790bfd1fd677c0b77833d5.zip
autotools: correctly build canvas-related code
spice client and spice server shares code from common/{gdi,gl,sw}_canvas.[ch]. However, while most of the code is shared, the server code wants a canvas compiled with SW_CANVAS_IMAGE_CACHE defined while the client code wants a canvas compiled with SW_CANVAS_CACHE. The initial autotools refactoring didn't take that into account, this is now fixed by this commit. After this commit, the canvas files from common/ are no longer compiled as part of the libspice-common.la convenience library. Instead, there are "proxy" canvas source files in client/ and server/ which #include the appropriate C files after defining the relevant #define for the binary that is being built. To prevent misuse of the canvas c files and headers in common/, SPICE_CANVAS_INTERNAL must be set when including the canvas headers from common/ or when building the c files from common/ otherwise the build will error out.
Diffstat (limited to 'client')
-rw-r--r--client/Makefile.am2
-rw-r--r--client/application.cpp6
-rw-r--r--client/canvas.h1
-rw-r--r--client/glz_decoder.h2
-rw-r--r--client/jpeg_decoder.h2
-rw-r--r--client/red_canvas_base.h26
-rw-r--r--client/red_gdi_canvas.cpp6
-rw-r--r--client/red_gdi_canvas.h4
-rw-r--r--client/red_gl_canvas.cpp6
-rw-r--r--client/red_gl_canvas.h5
-rw-r--r--client/red_sw_canvas.cpp6
-rw-r--r--client/red_sw_canvas.h4
-rw-r--r--client/windows/redc.vcproj8
-rw-r--r--client/zlib_decoder.h2
14 files changed, 65 insertions, 15 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index 627bd8a7..2508267e 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -77,6 +77,7 @@ spicec_SOURCES = \
process_loop.h \
read_write_mutex.h \
record_channel.cpp \
+ red_canvas_base.h \
red_channel.cpp \
red_channel.h \
red_client.cpp \
@@ -208,7 +209,6 @@ endif
INCLUDES = \
- -DSW_CANVAS_CACHE \
-D__STDC_LIMIT_MACROS \
-I$(top_srcdir)/client/x11 \
-I$(top_srcdir)/common \
diff --git a/client/application.cpp b/client/application.cpp
index 292dae6a..9e2c7e19 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -31,8 +31,10 @@
#include "red_gdi_canvas.h"
#endif
#include "platform.h"
-#include "sw_canvas.h"
-#include "gl_canvas.h"
+#include "red_sw_canvas.h"
+#ifdef USE_OGL
+#include "red_gl_canvas.h"
+#endif
#include "quic.h"
#include "mutex.h"
#include "cmd_line_parser.h"
diff --git a/client/canvas.h b/client/canvas.h
index 4844c314..0b8f2b65 100644
--- a/client/canvas.h
+++ b/client/canvas.h
@@ -25,7 +25,6 @@
#include "messages.h"
#include "cache.hpp"
#include "shared_cache.hpp"
-#include "canvas_base.h"
#include "canvas_utils.h"
#include "glz_decoded_image.h"
#include "glz_decoder.h"
diff --git a/client/glz_decoder.h b/client/glz_decoder.h
index f046f8c8..35b0a3ed 100644
--- a/client/glz_decoder.h
+++ b/client/glz_decoder.h
@@ -22,7 +22,7 @@
#include "lz_common.h"
#include "glz_decoder_config.h"
#include "glz_decoder_window.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
class GlzDecodeHandler {
public:
diff --git a/client/jpeg_decoder.h b/client/jpeg_decoder.h
index bd83b2e4..34aa3362 100644
--- a/client/jpeg_decoder.h
+++ b/client/jpeg_decoder.h
@@ -20,7 +20,7 @@
#define _H_JPEG_DECODER
#include "common.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
#ifdef WIN32
/* We need some hacks to avoid warnings from the jpeg headers */
diff --git a/client/red_canvas_base.h b/client/red_canvas_base.h
new file mode 100644
index 00000000..bd59109c
--- /dev/null
+++ b/client/red_canvas_base.h
@@ -0,0 +1,26 @@
+/*
+ Copyright (C) 2011 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_RED_CANVAS_BASE
+#define _H_RED_CANVAS_BASE
+
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "canvas_base.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
+#endif
diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp
index 72b31df3..2e0b4538 100644
--- a/client/red_gdi_canvas.cpp
+++ b/client/red_gdi_canvas.cpp
@@ -23,6 +23,12 @@
#include "region.h"
#include "red_pixmap_gdi.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "gdi_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
GDICanvas::GDICanvas(int width, int height, uint32_t format,
PixmapCache& pixmap_cache, PaletteCache& palette_cache,
GlzDecoderWindow &glz_decoder_window, CSurfaces &csurfaces)
diff --git a/client/red_gdi_canvas.h b/client/red_gdi_canvas.h
index 643f3c6c..76de12bc 100644
--- a/client/red_gdi_canvas.h
+++ b/client/red_gdi_canvas.h
@@ -19,7 +19,11 @@
#define _H_GDICANVAS
#include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
#include "gdi_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
#include "red_pixmap_gdi.h"
class RedPixmap;
diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp
index d7841b94..db47aafa 100644
--- a/client/red_gl_canvas.cpp
+++ b/client/red_gl_canvas.cpp
@@ -24,6 +24,12 @@
#include "red_pixmap_gl.h"
#include <GL/glx.h>
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "gl_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
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 02609586..83e6512a 100644
--- a/client/red_gl_canvas.h
+++ b/client/red_gl_canvas.h
@@ -19,8 +19,13 @@
#define _H_GCANVAS
#include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
#include "sw_canvas.h"
#include "gl_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
#include "red_pixmap_gl.h"
#include "red_window.h"
diff --git a/client/red_sw_canvas.cpp b/client/red_sw_canvas.cpp
index b580e61d..fec6605e 100644
--- a/client/red_sw_canvas.cpp
+++ b/client/red_sw_canvas.cpp
@@ -25,6 +25,12 @@
#include "region.h"
#include "red_pixmap_sw.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
+#include "sw_canvas.c"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
+
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 ebac7109..2f807c7e 100644
--- a/client/red_sw_canvas.h
+++ b/client/red_sw_canvas.h
@@ -20,7 +20,11 @@
#define _H_CCANVAS
#include "canvas.h"
+#define SPICE_CANVAS_INTERNAL
+#define SW_CANVAS_CACHE
#include "sw_canvas.h"
+#undef SW_CANVAS_CACHE
+#undef SPICE_CANVAS_INTERNAL
class RedPixmap;
diff --git a/client/windows/redc.vcproj b/client/windows/redc.vcproj
index 0b1ecbf1..70eb1708 100644
--- a/client/windows/redc.vcproj
+++ b/client/windows/redc.vcproj
@@ -413,10 +413,6 @@
>
</File>
<File
- RelativePath="..\..\common\gdi_canvas.c"
- >
- </File>
- <File
RelativePath="..\generated_demarshallers.cpp"
>
</File>
@@ -637,10 +633,6 @@
>
</File>
<File
- RelativePath="..\..\common\sw_canvas.c"
- >
- </File>
- <File
RelativePath="..\threads.cpp"
>
</File>
diff --git a/client/zlib_decoder.h b/client/zlib_decoder.h
index 44440402..c91ed494 100644
--- a/client/zlib_decoder.h
+++ b/client/zlib_decoder.h
@@ -20,7 +20,7 @@
#define _H_ZLIB_DECODER
#include "common.h"
-#include "canvas_base.h"
+#include "red_canvas_base.h"
#ifndef __GNUC__
#define ZLIB_WINAPI