[…]
But regarding the multiple window support in SDL -
the current design of the eventsystem in SDL doesn’t
support events to be dispatched to different windows -
I’m thinking especially of mouseevents here.
How would you know in which window a mouse move
(or whatever) event actually occurred?
Yeah… However, it’s not as simple as “send all events to the window under
the mouse pointer…”
The usual solution seems to be to add the concepts “focused window”, “mouse
capture” and a few other, rather simple “filters”, and then provide an API
for that, for toolkits and to some extent, applications, to use. Every window
would have some kind of “event port”.
Idea: If a window isn’t equipped with an event port, the events can fall
through to it’s parent, or something… Would make it possible to use the
same window abstraction like a more lightweight overlapping + clipping
rendering control primitive; an advanced cliprect object.
So, I’m thinking of another approach of doing this…
Add some functions to SDL that allows it to work
with / co-exist with the native backend of the
OS. I know it’s ugly and platformdependent etc. -
but it would really be useful in many cases.
(also, see the post of
"Raw Nerves" ,
subject: “win32 API for an SDL window application.”).
And it means that you have access to anything
that you would otherwise have in the native
OS that you’re using! Esentially making sure
that there are no “limitations” to using SDL…
In a sense, it would make SDL more “open”.
I would, however, only be insterested in ( = have time
for) implementing a win32 version of this feature -
at least for now.
You would probably only need a few functions
to “assign” an SDL_Surface to a native window -
and vice versa. Of couse it must be convenient
to do this so that you retain framebuffer formats
etc.
I don’t see how this could be done using a portable API…
With something like this (assuming that somebody
eventually writes something similar for all supported
OS’es) - people could make extra separate libraries
for SDL with as many weird OS-specific features as
desired and with support for as many platforms as
time / possibilities permit.
…then again, that might not be the point? It does make some sense to build
some low level hooks into SDL, but I’m not sure it makes much sense to this
low a level.
Considering that there already are things like flags for borderless windows,
fullscreen mode etc, it sounds like supporting multiple screen surfaces is
just another step - which could be extended with some way of snapping in
window managers for fullscreen modes and that kind of stuff. (In that case,
the fullscreen window manager would do the event dispatching, pretty much
like the target’s WM does with “normal” windows. No difference for SDL
applications.)
It would be logical that these fullscreen window managers would show up
behind the existing window manager API, of course. In fact, the current SDL
WM code could probably use the same “plugin” API as the fullscreen window
managers.
It might be a good idea to make sure that “WM inside WM” is possible, though.
Most importantly, that would allow a custom WM to be used inside a normal
window on windowed target.
I don’t know when / if I’ll have time to hack
something like this up - but at some point I might
just do it and call it a “suggestion for new features”
Any comments are most welcome though
Well, you got some above.
BTW, note that I’m thinking in terms of what may make sense for SDL 1.3, but
might be messy to hack into 1.2. Without multiple screen surface support and
complex region clipping, only half of the features can be done right… And
why mess with it if it’s going to be done right anyway?
It’s probably possible to come up with some shortcut, but I’m failing to see
one that both provides something truly useful, and is still clean and
portable…
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Friday 11 May 2001 20:28, Anoq of the Sun wrote: