SDL 1.3 Modal windows

Hello guys,

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.

I played with SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_MOUSE_FOCUS flags on MacOSX but none of them seems to do the job.

Thanks for any tips.

regards,
Pavel Kanzelsberger
www.mediaware.sk

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

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

Hi,

OK, now I understand what you want. However:

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.

I believe there is an extremely low number of cases where that should
be necessary or, in fact, acceptable. If an application opens a window
and then it does not allow me to interact with all my other other
applications, that’s a mortal sin in my book. Where it is accaptable is
when the window informs me that a fatal system error occured, and the
machine will reboot. The other is a game in a window where I can tell
the game to keep the pointer within the window (but can release at any
time). In the latter case it is my choice to tell the window to grab
the pointer, explicitely expressed by me and not a decision made by the
machine. Apart from that, under no circumstances should an application
limit my ability to interact with my other applications. Furthermore,
an application should never, ever warp the pointer out of an other
application’s window, should not switch focus on its own (when you type
while not looking at the screen and the focus is switched to a
different application, then the consequences are unpredictable).

Nevertheless, the above is just my personal opinion, which, alas, does
not help you with your immediate problem.

Zoltan