That leaves several other questions that need to be addressed:
- 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.
- 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.
- 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