Does full-screen SDL continue to steal focus?

Hello all,

I’ve got a front-end for xmame, written in SDL. Whenever I launch the
front-end full-screen however, and then launch xmame full-screen from there,
the xmame window is launched BEHIND the SDL window, thereby making it
impossible to do anything with it (and as the front-end waits for xmame to
return, it’s dead in the water as well). Now I’ve understood that xmame calls
XRaiseMap (is that the correct name?) to put itself on top, and normally it
seems to work (2 fullscreen xmame applications launched after eachother will
produce the correct effect, yet with the front-end it doesn’t work. Any
thoughts on what might cause this, and how I could fix it?

Regards,

Pieter Hulshoff

I’d suggest recalling SDL_SetVideoMode without SDL_FULLSCREEN before starting xmame…
you can re-call it with fullscreen after xmame is done.

or you could SDL_QuitSubSystem(SDL_INIT_VIDEO) before you start xmame
and SDL_InitSubSystem(SDL_INIT_VIDEO) after xmame is done
to completely close your window while xmame is running.
this might be nicer since then you will probably free up more resources for xmame.

-LIM-

Pieter Hulshoff wrote:> Hello all,

I’ve got a front-end for xmame, written in SDL. Whenever I launch the
front-end full-screen however, and then launch xmame full-screen from there,
the xmame window is launched BEHIND the SDL window, thereby making it
impossible to do anything with it (and as the front-end waits for xmame to
return, it’s dead in the water as well). Now I’ve understood that xmame calls
XRaiseMap (is that the correct name?) to put itself on top, and normally it
seems to work (2 fullscreen xmame applications launched after eachother will
produce the correct effect, yet with the front-end it doesn’t work. Any
thoughts on what might cause this, and how I could fix it?

Regards,

Pieter Hulshoff

I guess this would work, yet it won’t look very nice. The front-end displays
a loading message while xmame starts (which may take a few seconds). Removing
the video system in SDL will I presume give me a black screen while xmame starts?

Other than these workarounds: what might be causing this problem in the first
place? None of the other full-screen tools that I’ve seen (non-SDL) seem to be
suffering from this problem. Is it indeed an SDL problem, or is there something
I can do within my program to just avoid this behaviour?

Regards,

Pieter HulshoffOn Wed, Oct 20, 2004 at 05:44:31AM -0500, Jonathan Atkins wrote:

I’d suggest recalling SDL_SetVideoMode without SDL_FULLSCREEN before
starting xmame…
you can re-call it with fullscreen after xmame is done.

or you could SDL_QuitSubSystem(SDL_INIT_VIDEO) before you start xmame
and SDL_InitSubSystem(SDL_INIT_VIDEO) after xmame is done
to completely close your window while xmame is running.
this might be nicer since then you will probably free up more resources for
xmame.

SDL uses a layer priority to keep itself on top…at least I think it does in X11.

when you quit the subsystem the screen will return to the desktop.

you could just show an SDL window with a loading message (like a splash screen for xmame if you will)
perhaps with a log of the text that mame is spitting out…if any.
at least then it won’t just seem like the front end died.

-LIM-

Pieter Hulshoff wrote:> On Wed, Oct 20, 2004 at 05:44:31AM -0500, Jonathan Atkins wrote:

I’d suggest recalling SDL_SetVideoMode without SDL_FULLSCREEN before
starting xmame…
you can re-call it with fullscreen after xmame is done.

or you could SDL_QuitSubSystem(SDL_INIT_VIDEO) before you start xmame
and SDL_InitSubSystem(SDL_INIT_VIDEO) after xmame is done
to completely close your window while xmame is running.
this might be nicer since then you will probably free up more resources for
xmame.

I guess this would work, yet it won’t look very nice. The front-end displays
a loading message while xmame starts (which may take a few seconds). Removing
the video system in SDL will I presume give me a black screen while xmame starts?

Other than these workarounds: what might be causing this problem in the first
place? None of the other full-screen tools that I’ve seen (non-SDL) seem to be
suffering from this problem. Is it indeed an SDL problem, or is there something
I can do within my program to just avoid this behaviour?

SDL uses a layer priority to keep itself on top…at least I think it does
in X11.

Hmm, is this something that should be reconsidered perhaps or is there a good
reason for doing so?

when you quit the subsystem the screen will return to the desktop.
you could just show an SDL window with a loading message (like a splash
screen for xmame if you will)
perhaps with a log of the text that mame is spitting out…if any.
at least then it won’t just seem like the front end died.

Sounds like a good suggestion. I’ll have a look to see how much work it is
to integrate this into the front-end (time to create good looking splash
screen >> time to program the display of such splash screen:).

Regards,

Pieter HulshoffOn Wed, Oct 20, 2004 at 07:14:55AM -0500, Jonathan Atkins wrote:

Pieter Hulshoff wrote:> On Wed, Oct 20, 2004 at 07:14:55AM -0500, Jonathan Atkins wrote:

SDL uses a layer priority to keep itself on top…at least I think it does
in X11.

Hmm, is this something that should be reconsidered perhaps or is there a good
reason for doing so?

I think the reason was to prevent other windows from popping up on top of your fullscreen one…
basically what you want to happen is generally undesirable :wink:
From looking at the sdl code, it doesn’t do much special, not like mplayer did with layers,
but id does tell kde that it’s a top level window. What effect that has, I dunno.

in any case, setvid’ing to a windowed state and back is the best bet for you probably.

-LIM-

Pieter Hulshoff wrote:

SDL uses a layer priority to keep itself on top…at least I think it
does in X11.

Hmm, is this something that should be reconsidered perhaps or is there a
good
reason for doing so?

I think the reason was to prevent other windows from popping up on top of
your fullscreen one…
basically what you want to happen is generally undesirable :wink:

Hmm, I don’t know why noone ever encountered this problem before, but calling
one full-screen application from another doesn’t sound that weird to me. I’d
probably use this in any multimedia front-end I could think of.

From looking at the sdl code, it doesn’t do much special, not like mplayer
did with layers,
but id does tell kde that it’s a top level window. What effect that has, I
dunno.

Hmm, becomes tempting to spin off a version to include in the front-end… :wink:

in any case, setvid’ing to a windowed state and back is the best bet for
you probably.

Yes, I fear you are correct. I’ll have a look into this one. Thanx for all your
help. :slight_smile:

Regards,

Pieter HulshoffOn Wed, Oct 20, 2004 at 08:33:54AM -0500, Jonathan Atkins wrote:

On Wed, Oct 20, 2004 at 07:14:55AM -0500, Jonathan Atkins wrote: