Hi,
well but modal windows are different on every platform and SDL tries
to be a cross-platform abstraction of such features. SDL doesn’t need
to filter out events for non-modal windows if there’s some modal
window available.
Basically what will be a good addition to SDL is a SDL_WINDOW_MODAL
flag to be used with SDL_CreateWindow function. Basically it calls
some OS_CreateWindow function which already handles some kind of Modal
flags.
What I’m doing is a GUI based on SDL and I will of course filter
events if there’s modal window/dialog present, but what I need to do
is to DO NOT allow user to switch to another window, while there’s a
modal window on top of other windows. Soon or later users will be
facing this.
If SDL devs are not planning to introduce modal windows, atleast you
will need atleast something like following two functions:
SDL_GetActiveWindow
SDL_SetActiveWindow
Those will be used to get information about what window is currently
active and ability to switch to one of the windows. With these you
should be able to handle modal windows somehow. Even if
SDL_WINDOW_MODAL would be much better.
regards,
Pavel Kanzelsberger
www.mediaware.skOn 24.1.2010, at 10:32, Zolt?n K?csi wrote:
I’m new to this list, I searched the archive, but I’m not able to
find a solution to my problem. I’m using SDL 1.3 (latest from SVN)
and since docs are not yet ready, I’m trying to figure out how to
make a modal window with SDL. My app is going to have multiple
windows, and sometimes you need to present a modal window/dialog.
Maybe I’m wrong, but I think the issue here is that the modal dialog
(and the associated window) is a GUI paradigm, while SDL is a HW
abstraction layer. An SDL window is pretty much a canvas plus an event
system that tells you that the window received some input. You will
have to take care of not accepting any input in any other window of
your application while the window that you want to be modal is active.
By the way, grabbing the pointer is nasty, because that means that the
user can not interact with windows of other applications either, and
that’s frustrating beyond belief. Nevertheless, you need a GUI layer
on
top of SDL and that will give you the modality.
Zoltan
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Pavel Kanzelsberger
E-Mail: pavel at kanzelsberger.com
Jabber: kanzelsberger at jabber.org, ICQ: 20990633