Cut and Paste in SDL

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?

I’ve looked through the API docs and the FAQ on the Wiki and couldn’t see
anything relevant.

regards,

Colin–
Colin Tuckley | @Colin_Tuckley | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE

Experience is the hardest kind of teacher. It gives you the test first, and
the lesson afterwards. - Anonymous

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?)

–ryan.

Ryan C. Gordon wrote:

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

Thanks, sounds like I have some reading to do.

Colin–
Colin Tuckley | @Colin_Tuckley | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE

Experience is the hardest kind of teacher. It gives you the test first, and
the lesson afterwards. - Anonymous

As author of an SDL-based paint app that’s used in schools,
I’d certainly take advantage of it (eventually)

-bill!On Tue, Jan 09, 2007 at 03:39:02PM -0500, Ryan C. Gordon wrote:

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?)

As author of an SDL-based paint app that’s used in schools,
I’d certainly take advantage of it (eventually)

Copy&paste has become fairly “standard” across all platforms. If SDL
made a solution for it, I’d certainly include it in all my projects
where user input is required.

Simon

Le Tue, 09 Jan 2007 15:39:02 -0500
"Ryan C. Gordon" a ?crit:

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?)

At last, it’s already requested in bugzilla:
http://bugzilla.libsdl.org/show_bug.cgi?id=24

Some computer emulators using SDL could also take advantage of this.–
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Sp?cialit?: D?veloppement, jeux

I second the request for C&P functionality. It would be extremely useful.

JOn 1/9/07, Simon <simon.xhz at gmail.com> wrote:

As author of an SDL-based paint app that’s used in schools,
I’d certainly take advantage of it (eventually)

Copy&paste has become fairly “standard” across all platforms. If SDL
made a solution for it, I’d certainly include it in all my projects
where user input is required.

Simon


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I’d be happy to the OS X side implementation of this. Just had to do
it for another project so it’s fresh in my head.

CaseyOn 1/9/07, Patrice Mandin <mandin.patrice at wanadoo.fr> wrote:

At last, it’s already requested in bugzilla:
http://bugzilla.libsdl.org/show_bug.cgi?id=24

Some computer emulators using SDL could also take advantage of this.

Patrice Mandin wrote:

At last, it’s already requested in bugzilla:
http://bugzilla.libsdl.org/show_bug.cgi?id=24

Hmm… there is some example code linked from the bug that will do pretty
much what I want I think.

Some computer emulators using SDL could also take advantage of this.

Funny you should mention that - because it’s the reason I want it.

Colin–
Colin Tuckley | @Colin_Tuckley | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE

Common Sense is the collection of prejudices acquired by age eighteen. - A.
Einstein

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

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?)

I agree with others that this is a nice feature, but I am a bit sceptical
about having it in the core SDL library. In my mind this belong to
whatever SDL-based GUI that you use.On Tue, 9 Jan 2007, Ryan C. Gordon wrote:

Mattias Karlsson wrote:

I agree with others that this is a nice feature, but I am a bit sceptical
about having it in the core SDL library. In my mind this belong to
whatever SDL-based GUI that you use.

Err… What GUI? I need cut/paste in my emulator which has a direct I/F to SDL.

Colin–
Colin Tuckley | @Colin_Tuckley | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE

A. Because it breaks the logical sequence of discussion Q. Why is top
posting bad?

SDL is the platform independant interface to most of the system. Why
wouldn’t it be in there. It doesn’t make sense to have to hack some more
multi platform code on top of it to support c&p.On 1/10/07, Mattias Karlsson wrote:

On Tue, 9 Jan 2007, Ryan C. Gordon wrote:

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?)

I agree with others that this is a nice feature, but I am a bit sceptical
about having it in the core SDL library. In my mind this belong to
whatever SDL-based GUI that you use.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Le 10 janv. 07 ? 00:01, E. Wing a ?crit :

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.

This would be a nice addition indeed. However having a quick look at
SDL_scrap, I would suggest to use something more flexible than an
integer for pasteboard content types, I think MIME content types [1]
would be more usefull to describe data.

Also if this :

get_scrap(T(‘T’,‘E’,‘X’,‘T’), &scraplen, &scrap);

is supposed to be only ASCII-encoded text, then the whole thing is
unusefull (yes there is an umlaut in my name).

Content negotiation (the client can get/provide the same data under
different formats) would also be nice but I wonder if all platform
specific api support it (osx does).

Best,

Daniel

[1] http://www.ietf.org/rfc/rfc2046.txt

I don’t. Hence my need for copy/paste being part of the core SDL library.
(Or, if not, its own add-on.)

-bill!On Wed, Jan 10, 2007 at 12:09:29PM +0100, Mattias Karlsson wrote:

I agree with others that this is a nice feature, but I am a bit sceptical
about having it in the core SDL library. In my mind this belong to
whatever SDL-based GUI that you use.

I agree with others that this is a nice feature, but I am a bit sceptical
about having it in the core SDL library. In my mind this belong to
whatever SDL-based GUI that you use.

I don’t. Hence my need for copy/paste being part of the core SDL library.
(Or, if not, its own add-on.)

Why must it be part of the core libary and not a add-on, like say SDL_net?

Am I the only one who have a nagging feeling that the core SDL library is
becoming more and more bloated? Or am I part of a dying breed of
developers that think that size realy do matters?On Wed, 10 Jan 2007, Bill Kendrick wrote:

On Wed, Jan 10, 2007 at 12:09:29PM +0100, Mattias Karlsson wrote:

SDL is the platform independant interface to most of the system. Why
wouldn’t it be in there. It doesn’t make sense to have to hack some more
multi platform code on top of it to support c&p.

Perhaps the same reasons that keep SDL, SDL_net, SDL_gfx, SDL_Mixer,
SDL_Image, SDL_ttf and your favorite GUI library separate: The
resulting libary would be so huge that noone would use it.

I see no reason why it needs to be part of the core library. All it has to
do is fetch stuff to/from the OS specific API and convert it to text,
surfaces or samples. SDL API already alows you to perform the second part
with relative ease, all that is needed is the first.On Wed, 10 Jan 2007, Jeremy wrote:

C&P support would add insignificant size to the library. networking,
graphix, sound, all the stuff you mention a

“Perhaps the same reasons that keep SDL, SDL_net, SDL_gfx, SDL_Mixer,
SDL_Image, SDL_ttf and your favorite GUI library separate: The
resulting libary would be so huge that noone would use it.”

C&P support would add insignificant size to the library. Networking, gfx,
sound, all the stuff you mention are seperated for the simple reason that
not everyone will want to use SDLs version of networking in favor of one of
many other alternatives out there. Same for sound support, image support,
certainly gui library, and ttf support. Further, most of those addons
require significant dependencies to function. C&P is a function provided by
pretty much every OS out there, and would ideally be wrapped up and
presented to the user in a platform independent manner, like the keyboard,
mouse, etc that is in the core library now. There is no reason for a
developer to use a ‘different c&p library’, so maintaining separation is a
inconvenience at best.

I see no reason why it needs to be part of the core library. All it has to

do is fetch stuff to/from the OS specific API and convert it to text,
surfaces or samples. SDL API already alows you to perform the second part
with relative ease, all that is needed is the first.

Yes, that’s ‘all it has to do’ which should make it a trivial inclusion into
the core library. Certainly more trivial to implement and include and more
convenient to the end users than making them download yet another add-on for
such standard OS functionality.

As a standard feature of the library it would enable developers to
significantly increase the usability of their programs for very little
effort. A separate library for C&P is overkill. That’s akin to having a
separate mouse library, and a joystick library. This is basic OS
functionality that most people expect, as they do keyboard, mouse support.
Not having it in the core is inconveniencing SDL developers, certainly much
more than an insignificant library ‘bloat’ it would result in.

JOn 1/10/07, Mattias Karlsson < betasoft at acc.umu.se> wrote:

On Wed, 10 Jan 2007, Jeremy wrote:


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Why must it be part of the core libary and not a add-on, like say
SDL_net?

Am I the only one who have a nagging feeling that the core SDL
library is
becoming more and more bloated? Or am I part of a dying breed of
developers that think that size realy do matters?

I agree, for me, having a lib as little as possible, doing only what
I want is my need.

I use SDL as a low level API to access OpenGL in a cross platform
way. And in our game, C&P is not needed.

It’s a feature which is nice, and I think it should be implemented as
an addon. Or maybe #define CP_SUPPORT, so we could compile from
scratch without it. (remember what the S in SDL stand for)

Just to clarify, we speak about C&P interaction with the OS right?
The ability to access OS last copy (or maybe history) and the ability
to put a new buffer in the OS stack? I think it’s not a trivial
feature, as OS can copy many things as already discussed.

I’m not an SDL coder, but as a user, I can say I want to keep the lib
as clean and small as possible.

RegardsOn Jan 10, 2007, at 11:31 PM, Mattias Karlsson wrote:


Kuon
Programmer and sysadmin.

“Computers should not stop working when the users’ brain does.”

Why must it be part of the core libary and not a add-on, like say SDL_net?

Well, as someone else said… then you may as well make keyboard, mouse, video, etc.
all add-ons. (I might have a game for a touch screen device that has no keyboard,
so why would I want keyboard support in my app?) :^)

If it IS a matter of "cut and paste functionality is too large to add to the core lib,"
then so be it, but it sounds like it’s relatively trivial.

In either case…

Am I the only one who have a nagging feeling that the core SDL library is
becoming more and more bloated? Or am I part of a dying breed of
developers that think that size realy do matters?

… isn’t that what "./configure --without-foo-support"
is for? :)On Wed, Jan 10, 2007 at 11:31:44PM +0100, Mattias Karlsson wrote:


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/