Class WindowsClipboard

java.lang.Object
limn.backend.lwjgl.transfer.WindowsClipboard
All Implemented Interfaces:
NativeClipboard

public final class WindowsClipboard extends Object implements NativeClipboard
The Windows clipboard, through a message-only window of our own.

Everything this process offers is rendered on demand: the formats are announced with no data, and WM_RENDERFORMAT asks for one when a program pastes. The window's messages arrive on the UI thread, inside GLFW's poll, so no thread of ours is involved in offering. A read is the other way round: any thread may open the clipboard, and the copy out of it is made on a short-lived one, so that a large picture is decoded off the UI thread.

What this process still owns when it closes is rendered then, as every Windows program does, so that what the user copied outlives the application.

A picture is offered twice, as the PNG format, which keeps its transparency, and as CF_DIB, which every program reads. It is read from PNG where there is one.