What next, was Re: X clipboard and SDL

I want to thank the people who have posted on this subject for bringing
out the underlying issues that must be addressed before this problem can
be solved. It seems to me that the point has been well made that the
event handling in SDL will/does interfere with the event delivery used
in cut-past/drag-n-drop, as implemented in existing windowing systems
such as MacOS, BeOS, X11, and Windows. This one point has changed my
mind about whether solving this problem requires an addition to core
SDL, clearly it does.

That leaves several other questions that need to be addressed:

  1. Is this feature important enough to enough people to make providing
    it worth the effort? I can see that I might want this feature in the
    future so I would say yes. I’m sure many will disagree with my opinion.

  2. In keeping with the minimalist structure of SDL, what is the minimum
    implementation that will solve this problem? I think it is unreasonable
    to ask for an actual “widget” to be added to SDL. That would require
    adding an entire GUI layer. On the other hand I suspect that the problem
    can be solved by adding a small number of new events and a couple of new
    functions. The idea would be to provide the means for doing drag-n-drop
    without providing a specific widget.

  3. Would someone like to start a new discussion by proposing a
    drag-n-drop API for SDL? The idea is to make a straw man proposal, and
    let people with detailed knowledge of the specific APIs of the various
    OSes critique it and propose modifications.

My experience is that once an API has been bashed around for a while and
completely defined, implementing it is straight forward.

		Bob Pendleton

int SDL_WM_DND_IsAvail(void)
Returns 1 if DND is available, 0 if not.

int SDL_WM_DND_Put(char *input)
Returns 0 on success, -1 on failure.
Puts input[] onto the clipboard.

char *SDL_WM_DND_Get(void)
Returns the clipboard text or NULL if there is no text data
on the clipboard.

See you,
Jakob–
Im Ausblick auf den bevorstehenden Winter habe ich mir eine
hochwertige Elektroheizung zugelegt (Thunderbird 1,4 GHZ)."
Sven Arnhold in tuc.comp

int SDL_WM_DND_Put(char *input)
char *SDL_WM_DND_Get(void)

While this might work for cutting and pasting
from the clipboard in most cases, it has definite
problems if a user drags and drops a file into
a window. (load a saved game anyone?) That said,
how SDL would handle file drag and drop isn’t
clear to me. All I know is you’d probably need
an event, as you’d also want the positional aspect.

Also to keep the naming more orthogonal I’d
sugest renaming them to:

SDL_WM_GetClipboard
SDL_WM_SetClipboard

(and by ommision of DND avoid a nasty copyright battle
with hasbro, or the need to implement file/icon DND)–
David J. Goehrig dave at cthulhu-burger.org

All reports, excluding those of historical fact, may be considered speculative.
- a faceless Compaq disclaimer

Jakob Kosowski wrote:

int SDL_WM_DND_IsAvail(void)
Returns 1 if DND is available, 0 if not.

I think this needs to be coupled with an event to let you know when the
clipboard becomes available or changes.

int SDL_WM_DND_Put(char *input)
Returns 0 on success, -1 on failure.
Puts input[] onto the clipboard.

This one needs a length field. I suspect their needs to be a way to
handle 16 bit character sets too.

int SDL_WM_DND_Put(int len, char *input)

char *SDL_WM_DND_Get(void)
Returns the clipboard text or NULL if there is no text data
on the clipboard.

Does there need to a “free” function to go with this so that the data
can be freed when you are done with it? Or could this be implemented as
something more like

int SDL_WM_Clipboard_BytesAvailable(); // get the length of the data
that is available
SDL_WM_Clipboard_Get(int maxlen, char *data); // get at most maxlen
bytes into the buffer>

See you,
Jakob


Im Ausblick auf den bevorstehenden Winter habe ich mir eine
hochwertige Elektroheizung zugelegt (Thunderbird 1,4 GHZ)."
Sven Arnhold in tuc.comp


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


±-----------------------------------+

  • Bob Pendleton is seeking contract +
  • and consulting work. Find out more +
  • at http://www.jump.net/~bobp +
    ±-----------------------------------+

“Bob Pendleton” wrote in message
news:mailman.1012503859.24354.sdl at libsdl.org

int SDL_WM_Clipboard_BytesAvailable(); // get the length of the data
that is available
SDL_WM_Clipboard_Get(int maxlen, char *data); // get at most maxlen
bytes into the buffer

Not good. Consider that the clipboard contents might change between
the call to ‘…_BytesAvailable’ and the call to ‘…_Get’.–
Rainer Deyke | root at rainerdeyke.com | http://rainerdeyke.com

Doh. s/DND/Clip/. Perhaps I should go to bed now.

See you,
JakobOn Thu, Jan 31, 2002 at 06:29:05PM +0100, Jakob Kosowski wrote:

int SDL_WM_DND_IsAvail(void)
int SDL_WM_DND_Put(char *input)
char *SDL_WM_DND_Get(void)


Im Ausblick auf den bevorstehenden Winter habe ich mir eine
hochwertige Elektroheizung zugelegt (Thunderbird 1,4 GHZ)."
Sven Arnhold in tuc.comp

That leaves several other questions that need to be addressed:

  1. Is this feature important enough to enough people to make providing
    it worth the effort? I can see that I might want this feature in the
    future so I would say yes. I’m sure many will disagree with my opinion.

Clipboard access at least to text data is important enough to me. I would
not myself use graphical data in the clipboard, nor is drag and drop even
worth considering given what little I know about the nature of existing
DND standards - it’s too specific to a given implementation to be useful
from a portable interface such as SDL without implementing too much.

  1. In keeping with the minimalist structure of SDL, what is the minimum
    implementation that will solve this problem? I think it is unreasonable
    to ask for an actual “widget” to be added to SDL. That would require
    adding an entire GUI layer. On the other hand I suspect that the problem
    can be solved by adding a small number of new events and a couple of new
    functions. The idea would be to provide the means for doing drag-n-drop
    without providing a specific widget.

I don’t believe DND can be done without supporting widgets as most of the
nicer implementations do let you drop very complex objects on applications
which have to tell the OS ahead of time whether or not they can receive
them. What types then can a SDL program receive? Best to receive nothing
via DND and simply accept text and graphic clipboard content.

  1. Would someone like to start a new discussion by proposing a
    drag-n-drop API for SDL? The idea is to make a straw man proposal, and
    let people with detailed knowledge of the specific APIs of the various
    OSes critique it and propose modifications.

My experience is that once an API has been bashed around for a while and
completely defined, implementing it is straight forward.

Seems straightforward enough:

enum SDL_Clipboard_ReadClipboard (void);

Returns SDL_CLIPBOARDNONE, SDL_CLIPBOARDTEXT, SDL_CLIPBOARDSURF (or
similar constants) for use withL

char *SDL_Clipboard_GetText (void);
SDL_Surface *SDL_Clipboard_GetSurface (void);

This is the most CS-student correct approach. The version which gets
used by the rest of us and gets frowns from our old CS profs would be:

enum SDL_Clipboard_ReadClipboard (void **);

…and is of course the only function used for reading. I think the
first implementation is more in fitting with the general design of SDL,
which seems to go to reasonably great lengths to not pass around untyped
pointers like that. =)

For writing I only suggest one interface:

SDL_bool SDL_Clipboard_WriteText (char *);
SDL_bool SDL_Clipboard_WriteSurface (SDL_Surface *);

The program may care, and then it may not, whether this operation was a
success or failure. I don’t even propose to use the write feature
myself, so clearly I don’t care. =) It should be there all the same,
though.

No widgets, no DND, no GUI implementation. Just an interface to the
outside world, available only when there’s an outside world to interface
with. I have no tie to names of constants or functions though, if you
don’t like those feel free to suggest better ones. =)On Thu, Jan 31, 2002 at 10:57:05AM -0600, Bob Pendleton wrote:


Joseph Carter Caffiene is a good thing

Windoze CEMeNT: Now with CrackGuard™! Never worry about
unsightly cracks in Windoze CEMeNT again! CrackGuard™ is
so powerful that the entire thing will crumble before it will
crack. Order your $200 upgrade version today!

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020131/e67cf85c/attachment.pgp