add missing converters
This commit is contained in:
parent
c22571658d
commit
490e239464
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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<const UInt8*>(pngdata.data());
|
||||||
|
|
||||||
|
if (rawPNGHeader[0] == 0x89 && rawPNGHeader[1] == 0x50 && rawPNGHeader[2] == 0x4e && rawPNGHeader[3] == 0x47) {
|
||||||
|
LOG((CLOG_DEBUG2 "Prepare PNG"));
|
||||||
|
return pngdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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<const UInt8*>(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 {};
|
||||||
|
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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<const UInt8*>(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 {};
|
||||||
|
}
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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;
|
||||||
|
};
|
Loading…
Reference in New Issue