Feasibility question

“William Kendrick” wrote

There is no SDL_WM_RestoreWindow() or SDL_WM_DeiconifyWindow().

Umm… at least in SDL 1.1.6, there IS no such thing as those two
functions! :slight_smile:

Help! My window can’t _un_iconify itself! I guess it’s a strange and
obscure thing for a program to want to uniconify itself, but in this
case, the program is kind of a visual alarm clock, so it’s quite
necessary! :slight_smile:

i’m guessing calling SetMode again will create a new window
that is not iconified. might not be the prettiest solution, but
my guess is it will work.

There is no SDL_WM_RestoreWindow() or SDL_WM_DeiconifyWindow().

Umm… at least in SDL 1.1.6, there IS no such thing as those two
functions! :slight_smile:

Well, you can try this code from Loki, but for some reason we stopped using
it, I don’t remember why…

#if 0 /* Obsolete by SDL 1.0.2 (now use SDL_WM_IconifyWindow()) /
/
Once the window is iconified, it doesn’t get input until the window
manager brings it back, so sdl_IconifyWindow(0) is nearly useless.
*/
int sdl_IconifyWindow(int on)
{
SDL_SysWMinfo info;
SDL_Surface *sdl_screen;
int retval = 0;

/* See if the display is in fullscreen mode */
sdl_screen = SDL_GetVideoSurface();
if ( !sdl_screen || (sdl_screen->flags & SDL_FULLSCREEN) ) {
    return retval;
}

SDL_VERSION(&info.version);
if ( SDL_GetWMInfo(&info) > 0 ) {

#ifdef unix
if ( info.subsystem == SDL_SYSWM_X11 ) {
Display *display;
Window window;

        info.info.x11.lock_func();
        display = info.info.x11.display;
        window = info.info.x11.window;

        if ( on ) {
            /* Notify the window manager and unmap the window.
               Don't wait for the iconify to complete, otherwise
               SDL will miss the deactivation event.
             */
            XIconifyWindow(display, window, DefaultScreen(display));
        } else {
            /* Map the window.
               Don't wait for the map to complete, otherwise
               SDL will miss the activation event.
             */
            XMapWindow(display, window);
        }
        retval = 1;
        info.info.x11.unlock_func();
    }

#else
#error Need to implement these functions for other systems
#endif // unix
}
return retval;
}
#endif /* Obsolete by SDL 1.0.2 */

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

i’m guessing calling SetMode again will create a new window
that is not iconified.

So ask SDL to reopen the window with the same dimensions?

might not be the prettiest solution, but
my guess is it will work.

Yes, not a nice solution. Why isn’t there just an “uniconify” func?
(I imagined it was because there wasn’t ever really a need.)

-bill!

> SDL_VERSION(&info.version); > if ( SDL_GetWMInfo(&info) > 0 ) { > #ifdef unix > if ( info.subsystem == SDL_SYSWM_X11 ) { > Display *display; > Window window; > > info.info.x11.lock_func(); > display = info.info.x11.display; > window = info.info.x11.window; > > if ( on ) { > /* Notify the window manager and unmap the window. > Don't wait for the iconify to complete, otherwise > SDL will miss the deactivation event. > */ > XIconifyWindow(display, window, DefaultScreen(display)); > } else { > /* Map the window. > Don't wait for the map to complete, otherwise > SDL will miss the activation event. > */ > XMapWindow(display, window); > } > retval = 1; > info.info.x11.unlock_func(); > } > #else > #error Need to implement these functions for other systems > #endif // unix

Ugh! Hehe… I kinda would like this app to work under Windows and
MacOS, too. :slight_smile:

Perhaps folks with experience in the other supported environments
(Windows, MacOS, BeOS, Amiga) could expand upon this and it could all
culminate into an “UnIconifyWindow” function?

I’d really like it. :slight_smile: I’m seeing my chiropractor again today,
so I’ll have some content for this program soon. :slight_smile:

-bill!