[SDL] Cut and Paste in SDL

E. Wing ewmailing at gmail.com
Tue Jan 9 15:01:15 PST 2007


>> Is it possible to use cut and paste to paste text into an SDL application
>> and have the characters seen in the event handler somehow so they can be
>> processed?

> There's no clipboard support in SDL 1.2. You'll have to talk to the
> platform's APIs for that.

> (Are we changing that for 1.3?)


Sam has a little demo library/app called SDL_Scrap which does very
basic copy and paste. But it is only implemented for Windows and X11.
I think it also uses it's own protocols so there is some limitation
with copying data for other applications to read (e.g. you can't copy
an image to the clipboard and expect to get Photoshop to read it or
vice-versa).

Several months ago, I added a Cocoa backend and also (tried) to add
the capability to copy and paste images so it can be used universally
across other apps that use the pasteboard. I got the code working on
Mac and Windows, but I am getting broken behavior with copy and paste
in general (both images and text) with my Linux box. I don't know X11
well enough to fix the problem.

I submitted some of the changes back to Sam. (I think there was one
more change I didn't give to Sam yet which was probably a minor
Windows fix.) He did ask if he could use it for SDL 1.3, which I
agreed to so I hope to see it in the core.

I can dig around for my modifications to SDL_scrap if you want them.
(Or maybe Sam has them posted somewhere already?)

-Eric




More information about the SDL mailing list