diff --git a/src/lib/platform/XWindowsClipboardJPGConverter.h b/src/lib/platform/XWindowsClipboardJPGConverter.h
new file mode 100644
index 00000000..03234a86
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardJPGConverter.h
@@ -0,0 +1,40 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "platform/XWindowsClipboard.h"
+
+//! Convert to/from some text encoding
+class XWindowsClipboardJPGConverter :
+ public IXWindowsClipboardConverter {
+public:
+ XWindowsClipboardJPGConverter(Display* display);
+ virtual ~XWindowsClipboardJPGConverter();
+
+ // IXWindowsClipboardConverter overrides
+ virtual IClipboard::EFormat
+ getFormat() const;
+ virtual Atom getAtom() const;
+ virtual int getDataSize() const;
+ virtual std::string fromIClipboard(const std::string&) const;
+ virtual std::string toIClipboard(const std::string&) const;
+
+private:
+ Atom m_atom;
+};
diff --git a/src/lib/platform/XWindowsClipboardPNGConverter.cpp b/src/lib/platform/XWindowsClipboardPNGConverter.cpp
new file mode 100644
index 00000000..500deddd
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardPNGConverter.cpp
@@ -0,0 +1,72 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "base/Log.h"
+#include "platform/XWindowsClipboardPNGConverter.h"
+
+//
+// XWindowsClipboardPNGConverter
+//
+
+XWindowsClipboardPNGConverter::XWindowsClipboardPNGConverter(
+ Display* display) :
+ m_atom(XInternAtom(display, "image/png", False))
+{
+ // do nothing
+}
+
+XWindowsClipboardPNGConverter::~XWindowsClipboardPNGConverter()
+{
+ // do nothing
+}
+
+IClipboard::EFormat
+XWindowsClipboardPNGConverter::getFormat() const
+{
+ return IClipboard::kPNG;
+}
+
+Atom
+XWindowsClipboardPNGConverter::getAtom() const
+{
+ return m_atom;
+}
+
+int
+XWindowsClipboardPNGConverter::getDataSize() const
+{
+ return 8;
+}
+
+std::string XWindowsClipboardPNGConverter::fromIClipboard(const std::string& pngdata) const
+{
+ return pngdata;
+}
+
+std::string XWindowsClipboardPNGConverter::toIClipboard(const std::string& pngdata) const
+{
+ // check PNG file header
+ const UInt8* rawPNGHeader = reinterpret_cast(pngdata.data());
+
+ if (rawPNGHeader[0] == 0x89 && rawPNGHeader[1] == 0x50 && rawPNGHeader[2] == 0x4e && rawPNGHeader[3] == 0x47) {
+ LOG((CLOG_DEBUG2 "Prepare PNG"));
+ return pngdata;
+ }
+
+ return {};
+}
diff --git a/src/lib/platform/XWindowsClipboardPNGConverter.h b/src/lib/platform/XWindowsClipboardPNGConverter.h
new file mode 100644
index 00000000..71598855
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardPNGConverter.h
@@ -0,0 +1,40 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "platform/XWindowsClipboard.h"
+
+//! Convert to/from some text encoding
+class XWindowsClipboardPNGConverter :
+ public IXWindowsClipboardConverter {
+public:
+ XWindowsClipboardPNGConverter(Display* display);
+ virtual ~XWindowsClipboardPNGConverter();
+
+ // IXWindowsClipboardConverter overrides
+ virtual IClipboard::EFormat
+ getFormat() const;
+ virtual Atom getAtom() const;
+ virtual int getDataSize() const;
+ virtual std::string fromIClipboard(const std::string&) const;
+ virtual std::string toIClipboard(const std::string&) const;
+
+private:
+ Atom m_atom;
+};
diff --git a/src/lib/platform/XWindowsClipboardTIFConverter.cpp b/src/lib/platform/XWindowsClipboardTIFConverter.cpp
new file mode 100644
index 00000000..11ea040b
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardTIFConverter.cpp
@@ -0,0 +1,77 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "base/Log.h"
+#include "platform/XWindowsClipboardTIFConverter.h"
+
+//
+// XWindowsClipboardTIFConverter
+//
+
+XWindowsClipboardTIFConverter::XWindowsClipboardTIFConverter(
+ Display* display) :
+ m_atom(XInternAtom(display, "image/tiff", False))
+{
+ // do nothing
+}
+
+XWindowsClipboardTIFConverter::~XWindowsClipboardTIFConverter()
+{
+ // do nothing
+}
+
+IClipboard::EFormat
+XWindowsClipboardTIFConverter::getFormat() const
+{
+ return IClipboard::kTiff;
+}
+
+Atom
+XWindowsClipboardTIFConverter::getAtom() const
+{
+ return m_atom;
+}
+
+int
+XWindowsClipboardTIFConverter::getDataSize() const
+{
+ return 8;
+}
+
+std::string XWindowsClipboardTIFConverter::fromIClipboard(const std::string& tiffdata) const
+{
+ return tiffdata;
+}
+
+std::string XWindowsClipboardTIFConverter::toIClipboard(const std::string& tiffdata) const
+{
+ // check TIFF file header, veirfy if Big or Little Endian
+ const UInt8* rawTIFHeader = reinterpret_cast(tiffdata.data());
+
+ if (rawTIFHeader[0] == 0x49 && rawTIFHeader[1] == 0x49 && rawTIFHeader[2] == 0x2a && rawTIFHeader[3] == 0x00) {
+ LOG((CLOG_DEBUG2 "Prepare Tiff (BE)"));
+ return tiffdata;
+ }
+
+ if (rawTIFHeader[0] == 0x4D && rawTIFHeader[1] == 0x4D && rawTIFHeader[2] == 0x00 && rawTIFHeader[3] == 0x2a) {
+ LOG((CLOG_DEBUG2 "Prepare Tiff (LE)"));
+ return tiffdata;
+ }
+
+ return {};
+}
diff --git a/src/lib/platform/XWindowsClipboardTIFConverter.h b/src/lib/platform/XWindowsClipboardTIFConverter.h
new file mode 100644
index 00000000..3d1621de
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardTIFConverter.h
@@ -0,0 +1,40 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "platform/XWindowsClipboard.h"
+
+//! Convert to/from some text encoding
+class XWindowsClipboardTIFConverter :
+ public IXWindowsClipboardConverter {
+public:
+ XWindowsClipboardTIFConverter(Display* display);
+ virtual ~XWindowsClipboardTIFConverter();
+
+ // IXWindowsClipboardConverter overrides
+ virtual IClipboard::EFormat
+ getFormat() const;
+ virtual Atom getAtom() const;
+ virtual int getDataSize() const;
+ virtual std::string fromIClipboard(const std::string&) const;
+ virtual std::string toIClipboard(const std::string&) const;
+
+private:
+ Atom m_atom;
+};
diff --git a/src/lib/platform/XWindowsClipboardWEBPConverter.cpp b/src/lib/platform/XWindowsClipboardWEBPConverter.cpp
new file mode 100644
index 00000000..72df4ca6
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardWEBPConverter.cpp
@@ -0,0 +1,73 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "base/Log.h"
+#include "platform/XWindowsClipboardWEBPConverter.h"
+
+//
+// XWindowsClipboardWEBPConverter
+//
+
+XWindowsClipboardWEBPConverter::XWindowsClipboardWEBPConverter(
+ Display* display) :
+ m_atom(XInternAtom(display, "image/webp", False))
+{
+ // do nothing
+}
+
+XWindowsClipboardWEBPConverter::~XWindowsClipboardWEBPConverter()
+{
+ // do nothing
+}
+
+IClipboard::EFormat
+XWindowsClipboardWEBPConverter::getFormat() const
+{
+ return IClipboard::kWebp;
+}
+
+Atom
+XWindowsClipboardWEBPConverter::getAtom() const
+{
+ return m_atom;
+}
+
+int
+XWindowsClipboardWEBPConverter::getDataSize() const
+{
+ return 8;
+}
+
+std::string XWindowsClipboardWEBPConverter::fromIClipboard(const std::string& webpdata) const
+{
+ return webpdata;
+}
+
+std::string XWindowsClipboardWEBPConverter::toIClipboard(const std::string& webpdata) const
+{
+ // check WEBPF file header, veirfy if Big or Little Endian
+ const UInt8* rawWEBPHeader = reinterpret_cast(webpdata.data());
+
+ if (rawWEBPHeader[0] == 'R' && rawWEBPHeader[1] == 'I' && rawWEBPHeader[2] == 'F' && rawWEBPHeader[3] == 'F' &&
+ rawWEBPHeader[8] == 'W' && rawWEBPHeader[9] == 'E' && rawWEBPHeader[10] == 'B' && rawWEBPHeader[11] == 'P' ) {
+ LOG((CLOG_DEBUG2 "Prepare WEBP"));
+ return webpdata;
+ }
+
+ return {};
+}
diff --git a/src/lib/platform/XWindowsClipboardWEBPConverter.h b/src/lib/platform/XWindowsClipboardWEBPConverter.h
new file mode 100644
index 00000000..13983dd9
--- /dev/null
+++ b/src/lib/platform/XWindowsClipboardWEBPConverter.h
@@ -0,0 +1,40 @@
+/*
+ * barrier -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2016 Symless Ltd.
+ * Copyright (C) 2004 Chris Schoeneman
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include "platform/XWindowsClipboard.h"
+
+//! Convert to/from some text encoding
+class XWindowsClipboardWEBPConverter :
+ public IXWindowsClipboardConverter {
+public:
+ XWindowsClipboardWEBPConverter(Display* display);
+ virtual ~XWindowsClipboardWEBPConverter();
+
+ // IXWindowsClipboardConverter overrides
+ virtual IClipboard::EFormat
+ getFormat() const;
+ virtual Atom getAtom() const;
+ virtual int getDataSize() const;
+ virtual std::string fromIClipboard(const std::string&) const;
+ virtual std::string toIClipboard(const std::string&) const;
+
+private:
+ Atom m_atom;
+};