Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows clipboard drops Binary data package #217

Open
sophiapoirier opened this issue Jul 18, 2021 · 1 comment
Open

Windows clipboard drops Binary data package #217

sophiapoirier opened this issue Jul 18, 2021 · 1 comment
Labels

Comments

@sophiapoirier
Copy link

On Windows, if I supply a call to VSTGUI::getPlatformFactory().setClipboard with a VSTGUI::IDataPackage that kBinary data type, then a subsequent call to VSTGUI::getPlatformFactory().getClipboard() returns an object whose getCount() returns 0.

@sophiapoirier
Copy link
Author

To provide some code that I am working with that demonstrates the problem:

class SettingsDataPackage final : public VSTGUI::IDataPackage
{
public:
	SettingsDataPackage(std::byte const* inSettingsData, VstInt32 inSettingsDataSize)
	:	mData(inSettingsData, std::next(inSettingsData, inSettingsDataSize))
	{
	}

	uint32_t getCount() const override
	{
		return mData.empty() ? 0 : 1;
	}

	uint32_t getDataSize(uint32_t inIndex) const override
	{
		if (inIndex >= getCount())
		{
			return 0;
		}
		return mData.size();
	}

	Type getDataType(uint32_t inIndex) const override
	{
		if (inIndex >= getCount())
		{
			return kError;
		}
		return kBinary;
	}

	uint32_t getData(uint32_t inIndex, void const*& outBuffer, Type& outType) const override
	{
		outBuffer = (inIndex < getCount()) ? mData.data() : nullptr;
		outType = getDataType(inIndex);
		return getDataSize(inIndex);
	}

private:
	std::vector<std::byte> const mData;
};

and then:

auto const dataPackage = VSTGUI::makeOwned<SettingsDataPackage>(data, dataSize);
auto const success = VSTGUI::getPlatformFactory().setClipboard(dataPackage);

(which returns as successful)

and later:

auto const clipboardData = VSTGUI::getPlatformFactory().getClipboard();

where clipboardData->getCount() then returns 0.

@scheffle scheffle added the bug label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants