[SDL] SDL 1.3 Clipboard API enhancement proposal

Marcus von Appen mva at sysfault.org
Wed Nov 16 10:45:16 PST 2011


Hi Andreas,

On, Wed Nov 16, 2011, Andreas Schiffler wrote:

> Hi Marcus,
> 
> I like the idea but after having just written a few automated tests for 
> the clipboard API, I would recommend to clarify a few things:
> - Testability? Without pairs of GetXYZContent/PutXYZContent functions 
> and an integrated content-type system it will be hard to validate this 
> API extension I think.

What do you mean by integrated content-type system? Since the API
basically allows an application to put arbitrary strings as content
identifiers, we do not have to take care of an explicit content-type
system.
What we have to do is to take care of the implicit conversion routines,
the API aims to support.

> - How does the original API change (if at all)? Can the new 
> functionality be layered on top of an unchanged existing API? (recommended)

No. The original API will be put on top of the new system (see the
header file - it contains the existing 1.3 API). Especially since the
implementation and testing should not hold back a 1.3 release (but could
e.g. go into a later 1.3.x version). That means:

- API compatibility will be ensured
- ABI compatibility is likely to break

> - What is the use case? What would the "fancyclipboardtest" demo do?

The use-case is to have full clipboard support to allow sharing
(arbitrary) content between applications.
I do not know anything about a fancyclipboardtest demo - can you point
me to its location?

> - Can one use an image or wave file in SDL without external 
> dependencies  (i.e. SDL_image, Win32 API)?

As written in the proposal, BMP support could be implemented out of the
box on at least Win32 and X11, probably MacOS as well, though I am not
proficient with its APIs.
 
> Keep in mind that the X11 clipboard is difficult to handle properly in a 
> generic fashion:
> http://pvanhoof.be/files/Problems%20of%20the%20X11%20clipboard.pdf

I implemented it multiple times for now (e.g. for pygame), never got it
perfect but most of the times close enough to be considered good for
most cases of modern systems and applications. X11 is a horribly beast
and I am pretty much aware of it. The current implementation for X11
however lacks certain capabilities, so it would need to be overhauled in
some areas anyways, even for text support.
 
> I think a useful, simple enhancement would be the addition of a function 
> like "PutWindowScreenshotIntoClipboard()" similar to the Windows 
> PrintScreen-button functionality. Another one would be a simple 
> extension of the current API with a function that determines the current 
> content type (and provides a pointer to the captured content bits) for 
> non-text clipboard content without any more processing internal to SDL.

That simple enhancement (screenshot placement) would require about 80%
to 90% of the internals of my API proposal ;-).

Regards
Marcus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20111116/bfb2306b/attachment.pgp>


More information about the SDL mailing list