SDL Clipboard API: Recommendations based on research

On linux both GTK and QT run on top of X11.On Wed, Jul 21, 2010 at 7:50 PM, Jeremiah wrote:

Then perhaps, SDL_Clipboard should be based on GTK/QT instead?


±----------------------------------------------------------

Sam Lantinga wrote:

No, I understood what you meant.? I was just (silently) referring to an API that I was trying to provide support for, which expected an asynchronous notification when the clipboard contents changed.? No worries.

I see, then.
If it were not for X11’s design, I would agree that doing this would be a good idea. But certainly not a necessity for any application.

Yeah, I started working on a mime type based implementation and then
quickly ran into the fact that to support image copying and pasting I
would have to implement fairly complicated image converters for the
various platforms.

I quickly simplified it for SDL 1.3 release, but I structured the
functions such that there’s no reason we couldn’t add mime-type based
functions and extended clipboard support in the future. This could be
done now if someone is motivated to contribute it, or post release at
some point when someone really wants it.

I would say to just worry about converting it to one image format supported by the system. Then you can use it together with applications not built to support these mime types, but do support whatever is available from the system. On Win32, this would be bitmaps (which should be fairly easy with an SDL_Surface). Don’t know about other platforms.------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/

Unfortunately on Mac OS X, the format in question is TGA, which require
SDL_image support. :slight_smile:

In any case, I’ve punted it post 1.3, unless someone wants to contribute
working code sooner.On Wed, Jul 21, 2010 at 10:27 PM, Nathaniel J Fries wrote:

Sam Lantinga wrote:

No, I understood what you meant. I was just (silently) referring to an API
that I was trying to provide support for, which expected an asynchronous
notification when the clipboard contents changed. No worries.

I see, then.
If it were not for X11’s design, I would agree that doing this would be a
good idea. But certainly not a necessity for any application.

Yeah, I started working on a mime type based implementation and then
quickly ran into the fact that to support image copying and pasting I
would have to implement fairly complicated image converters for the
various platforms.

I quickly simplified it for SDL 1.3 release, but I structured the
functions such that there’s no reason we couldn’t add mime-type based
functions and extended clipboard support in the future. This could be
done now if someone is motivated to contribute it, or post release at
some point when someone really wants it.

I would say to just worry about converting it to one image format supported
by the system. Then you can use it together with applications not built to
support these mime types, but do support whatever is available from the
system. On Win32, this would be bitmaps (which should be fairly easy with an
SDL_Surface). Don’t know about other platforms.


EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

What?! Did nobody actually look at my real, actually working
implementation for Mac and Windows which has been sitting around for
years? Mac uses TIFF as the native format, but once you get that,
there are other OS provided things that let me convert to BMP. I got
all this to integrate nicely with SDL proper. No SDL_image required.
It’s all reasonably fast too.

Windows uses BMP. Unfortunately, there are a lot of missing
convenience things so I end up doing some hoop jumping creating proper
BMP headers, but I already did this nasty work for you. Again,
everything integrates nicely with SDL proper. No SDL_image required.
It seems reasonably fast too.

-EricOn 7/22/10, Sam Lantinga wrote:

Unfortunately on Mac OS X, the format in question is TGA, which require
SDL_image support. :slight_smile:

I would say to just worry about converting it to one image format
supported
by the system. Then you can use it together with applications not built to
support these mime types, but do support whatever is available from the
system. On Win32, this would be bitmaps (which should be fairly easy with
an
SDL_Surface). Don’t know about other platforms.

Yup, I did look at it, but I wanted to add arbitrary clipboard format
support which your code doesn’t have, and since I didn’t have time to
go the full length, I left it at simple text support for now. If you
have time, I’d love to discuss complete support with you… after the
high priority 1.3 bugs you have are taken care of. :slight_smile:

See ya!On Fri, Jul 23, 2010 at 1:52 AM, Eric Wing wrote:

On 7/22/10, Sam Lantinga <@slouken> wrote:

Unfortunately on Mac OS X, the format in question is TGA, which require
SDL_image support. :slight_smile:

I would say to just worry about converting it to one image format
supported
by the system. Then you can use it together with applications not built to
support these mime types, but do support whatever is available from the
system. On Win32, this would be bitmaps (which should be fairly easy with
an
SDL_Surface). Don’t know about other platforms.

What?! Did nobody actually look at my real, actually working
implementation for Mac and Windows which has been sitting around for
years? Mac uses TIFF as the native format, but once you get that,
there are other OS provided things that let me convert to BMP. I got
all this to integrate nicely with SDL proper. No SDL_image required.
It’s all reasonably fast too.

Windows uses BMP. Unfortunately, there are a lot of missing
convenience things so I end up doing some hoop jumping creating proper
BMP headers, but I already did this nasty work for you. Again,
everything integrates nicely with SDL proper. No SDL_image required.
It seems reasonably fast too.

-Eric


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


? ? -Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Sam Lantinga wrote:

Yup, I did look at it, but I wanted to add arbitrary clipboard format
support which your code doesn’t have, and since I didn’t have time to
go the full length, I left it at simple text support for now. If you
have time, I’d love to discuss complete support with you… after the
high priority 1.3 bugs you have are taken care of. :slight_smile:

See ya!

What he was saying is that doing so is not at all necessary or practical.

OS X and Windows have a specific format they want images in, TIFF and HBITMAP; respectively, and that’s the only conversion that’s worth any effort.
So, on OS X, just convert SDL_Surface to TIFF then back again.
On Win32, convert SDL_Surface to HBITMAP then back again.------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/