summaryrefslogtreecommitdiffstats
path: root/client/windows
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2010-12-06 17:59:09 +0200
committerAlon Levy <alevy@redhat.com>2010-12-08 17:13:52 +0200
commit1bb1bcb9a0e369b9663951d9ec944f31984ffdf7 (patch)
treec5b761d2be14d8993ff42a76ba75c2973018743b /client/windows
parent0449d0520c1173ca70eaf011f69de6123e5c2a48 (diff)
downloadspice-1bb1bcb9a0e369b9663951d9ec944f31984ffdf7.tar.gz
spice-1bb1bcb9a0e369b9663951d9ec944f31984ffdf7.tar.xz
spice-1bb1bcb9a0e369b9663951d9ec944f31984ffdf7.zip
mingw32 build: check for CXImage, disable if not found (only on mingw32)
v2: + simplify (Hans) + also report presence of cximage for mingw32 target
Diffstat (limited to 'client/windows')
-rw-r--r--client/windows/Makefile.am1
-rw-r--r--client/windows/platform.cpp15
2 files changed, 16 insertions, 0 deletions
diff --git a/client/windows/Makefile.am b/client/windows/Makefile.am
index 0bd6e42d..ae104ff4 100644
--- a/client/windows/Makefile.am
+++ b/client/windows/Makefile.am
@@ -21,6 +21,7 @@ INCLUDES = \
$(CEGUI_CFLAGS) \
$(WARN_CFLAGS) \
$(SPICE_NONPKGCONFIG_CFLAGS) \
+ $(CXIMAGE_CFLAGS) \
$(NULL)
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index b6f1918e..c41c39ad 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -32,7 +32,14 @@
#include "playback.h"
#include "cursor.h"
#include "named_pipe.h"
+
+#ifndef DISABLE_CXIMAGE
+#define USE_CXIMAGE
+#endif
+
+#ifdef USE_CXIMAGE
#include "ximage.h"
+#endif
#include <spice/vd_agent.h>
int gdi_handlers = 0;
@@ -82,6 +89,7 @@ static ClipboardFormat clipboard_formats[] = {
#define clipboard_formats_count (sizeof(clipboard_formats) / sizeof(clipboard_formats[0]))
+#ifdef USE_CXIMAGE
typedef struct ImageType {
uint32_t type;
DWORD cximage_format;
@@ -91,6 +99,7 @@ static ImageType image_types[] = {
{VD_AGENT_CLIPBOARD_IMAGE_PNG, CXIMAGE_FORMAT_PNG},
{VD_AGENT_CLIPBOARD_IMAGE_BMP, CXIMAGE_FORMAT_BMP},
};
+#endif
static std::set<uint32_t> grab_types;
@@ -154,6 +163,7 @@ static int get_available_clipboard_types(uint32_t** types)
return count;
}
+#ifdef USE_CXIMAGE
static DWORD get_cximage_format(uint32_t type)
{
for (size_t i = 0; i < sizeof(image_types) / sizeof(image_types[0]); i++) {
@@ -163,6 +173,7 @@ static DWORD get_cximage_format(uint32_t type)
}
return 0;
}
+#endif
static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -1005,6 +1016,7 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
case VD_AGENT_CLIPBOARD_UTF8_TEXT:
clip_data = utf8_alloc((LPCSTR)data, size);
break;
+#ifdef USE_CXIMAGE
case VD_AGENT_CLIPBOARD_IMAGE_PNG:
case VD_AGENT_CLIPBOARD_IMAGE_BMP: {
DWORD cximage_format = get_cximage_format(type);
@@ -1013,6 +1025,7 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
clip_data = image.CopyToHandle();
break;
}
+#endif
default:
LOG_INFO("Unsupported clipboard type %u", type);
return true;
@@ -1072,6 +1085,7 @@ bool Platform::on_clipboard_request(uint32_t type)
GlobalUnlock(clip_data);
break;
}
+#ifdef USE_CXIMAGE
case VD_AGENT_CLIPBOARD_IMAGE_PNG:
case VD_AGENT_CLIPBOARD_IMAGE_BMP: {
DWORD cximage_format = get_cximage_format(type);
@@ -1091,6 +1105,7 @@ bool Platform::on_clipboard_request(uint32_t type)
ret = true;
break;
}
+#endif
default:
LOG_INFO("Unsupported clipboard type %u", type);
}