How to control SDL window above other application windows all the time

Hello,

Thanks for your time.

When SDL lib was called, there would be a pup window created by SDL, but if there are other application windows on the computer screen at the same time and if one click other window, the window created by SDL may be shut off by other windows. My question is that if it possible to display SDL window above all the other windows all the time? In other words, if it possible to control the SDL window to display above or below other windwos all the time?

I really appreciate your help!

Best Regards!

gaofg <feng.necas gmail.com> writes:

In other words, if it possible
to control the SDL window to display above or below other windwos all the
time?

I really appreciate your help! Best
Regards!

I’m also interested in this. I have my fullscreen application
fireing other windows applications. When one launches
I need my application to go to the background
(it works by itself most of the time).
Where it really starts to break is when I shutdown
the created process, sometimes my SDL app doesn’t recover.
Right now I just have it sit and wait about 1.5 seconds
to give the OS a chance to catch up. This isn’t the most
reliable way, I would like to tell the SDL app
"Make yourself the top app".

Anyone out there?

Hi,

on Windows you can use something like this [not tested]:

#include “SDL.h”
#include “SDL_syswm.h”

static HWND GetSDLWindow(void)
{
SDL_SysWMinfo info;

SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info) == -1)
    return NULL;
return info.window;

}

static int SetZorder(HWND zorder)
{
HWND hWnd = GetSDLWindow();

if (!hWnd) return 0;
return SetWindowPos(hWnd, zorder, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

}

where zorder can be HWND_BOTTOM, HWND_NOTOPMOST, HWND_TOP, HWND_TOPMOST or
another window handle.

I alternate between HWND_NOTOPMOST and HWND_TOPMOST to do the always-on-top
thing,

cheers,
John.On Wed, Dec 06, 2006 at 07:42:43PM +0000, Chris Weed wrote:

gaofg <feng.necas gmail.com> writes:

In other words, if it possible
to control the SDL window to display above or below other windwos all the
time?

I really appreciate your help! Best
Regards!

I’m also interested in this. I have my fullscreen application
fireing other windows applications. When one launches
I need my application to go to the background
(it works by itself most of the time).
Where it really starts to break is when I shutdown
the created process, sometimes my SDL app doesn’t recover.
Right now I just have it sit and wait about 1.5 seconds
to give the OS a chance to catch up. This isn’t the most
reliable way, I would like to tell the SDL app
"Make yourself the top app".

Anyone out there?

Hi, thank you very for your consideration.

Your advice is of very important for me.
Now I working on Solaris 9 and Solaris 10 system. On this system, there no
Windows HAND, and just has similar concept called Widget . Is anybody
know that the similar resource or event such as HWND_BOTTOM on Solaris
or Unix system?

Best Regards!> On Wed, Dec 06, 2006 at 07:42:43PM +0000, Chris Weed wrote:

gaofg <feng.necas gmail.com> writes:

When SDL lib was called, there would be a pup window created by SDL,
but if there are other application windows on the computer screen at the
same time and if one click other window, the window created by SDL
may be shut off by other windows. My question is that if it possible to
display SDL window above all the other windows all the time?
In other words, if it possible to control the SDL window to display
above or below other windwos all the time?

I really appreciate your help! Best
Regards!

I’m also interested in this. I have my fullscreen application
fireing other windows applications. When one launches
I need my application to go to the background
(it works by itself most of the time).
Where it really starts to break is when I shutdown
the created process, sometimes my SDL app doesn’t recover.
Right now I just have it sit and wait about 1.5 seconds
to give the OS a chance to catch up. This isn’t the most
reliable way, I would like to tell the SDL app
"Make yourself the top app".

Anyone out there?
Hi,

on Windows you can use something like this [not tested]:

#include “SDL.h”
#include “SDL_syswm.h”

static HWND GetSDLWindow(void)
{
SDL_SysWMinfo info;

SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info) == -1)
return NULL;
return info.window;
}

static int SetZorder(HWND zorder)
{
HWND hWnd = GetSDLWindow();

if (!hWnd) return 0;
return SetWindowPos(hWnd, zorder, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
}

where zorder can be HWND_BOTTOM, HWND_NOTOPMOST, HWND_TOP, HWND_TOPMOST or
another window handle.

I alternate between HWND_NOTOPMOST and HWND_TOPMOST to do the always-on-top
thing,

cheers,
John.