Loosing control of SDL window

Hello

I’m having a problem with using SDL in windowed mode in windows. The
problem comes at random when minimizing, maximizing and/or iconifying the
window. What happens is that my program stop recieving events although the
window is active. I can resize the window, but no resize event is sent,
which causes problems as I can’t update the renderer with the new window
dimensions. Is this SDL not handling windows events properly? Or am I doing
something wrong?

Hello

I’m having a problem with using SDL in windowed mode in windows. The
problem comes at random when minimizing, maximizing and/or iconifying the
window. What happens is that my program stop recieving events although
the window is active. I can resize the window, but no resize event is
sent, which causes problems as I can’t update the renderer with the new
window dimensions. Is this SDL not handling windows events properly? Or
am I doing something wrong?

I tried debugging and it looks like the program is caught in an endless
loop in dinput.dll. Anyone have any idea why this is happening?

Hello

I’m having a problem with using SDL in windowed mode in windows. The
problem comes at random when minimizing, maximizing and/or iconifying
the window. What happens is that my program stop recieving events
although the window is active. I can resize the window, but no resize
event is sent, which causes problems as I can’t update the renderer with
the new window dimensions. Is this SDL not handling windows events
properly? Or am I doing something wrong?

I tried debugging and it looks like the program is caught in an endless
loop in dinput.dll. Anyone have any idea why this is happening?

I’ve managed to solve the problem. What I did was calling SDL_Init(0)
assuming the event handling subsystems would be initialized. However it
was’nt so I have to call SDL_Init() with SDL_INITVIDEO. This is not a good
solution for me because the video subsystem might not be used at all. So my
question now is if there is a way to initialize event handling without
initializing the video subsystem. Perhaps by calling internal SDL
functions? Can it be done in a way so that it does’nt create problems when
later calling SDL_InitSubSystem(SDL_INITVIDEO)?On Sun, 23 Nov 2003 21:52:23 +0100, Patrik Opacic <@Patrik_Opacic> wrote:

looking at the MANUAL it looks like you can just init the events (hehe, just
giving you a hard time).

http://sdldoc.csn.ul.ie/sdlinit.php

check that out for more info but it looks like
SDL_Init(SDL_INIT_EVENTTHREAD) will do what you want.

hope thats what your looking for (:

Atrix> ----- Original Message -----

From: opacic@swipnet.se (Patrik Opacic)
To:
Sent: Tuesday, November 25, 2003 12:58 PM
Subject: [SDL] Re: Loosing control of SDL window

On Sun, 23 Nov 2003 21:52:23 +0100, Patrik Opacic wrote:

Hello

I’m having a problem with using SDL in windowed mode in windows. The
problem comes at random when minimizing, maximizing and/or iconifying
the window. What happens is that my program stop recieving events
although the window is active. I can resize the window, but no resize
event is sent, which causes problems as I can’t update the renderer
with

the new window dimensions. Is this SDL not handling windows events
properly? Or am I doing something wrong?

I tried debugging and it looks like the program is caught in an endless
loop in dinput.dll. Anyone have any idea why this is happening?

I’ve managed to solve the problem. What I did was calling SDL_Init(0)
assuming the event handling subsystems would be initialized. However it
was’nt so I have to call SDL_Init() with SDL_INITVIDEO. This is not a good
solution for me because the video subsystem might not be used at all. So
my
question now is if there is a way to initialize event handling without
initializing the video subsystem. Perhaps by calling internal SDL
functions? Can it be done in a way so that it does’nt create problems when
later calling SDL_InitSubSystem(SDL_INITVIDEO)?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I’ve managed to solve the problem. What I did was calling SDL_Init(0)
assuming the event handling subsystems would be initialized. However it
was’nt so I have to call SDL_Init() with SDL_INITVIDEO. This is not a good
solution for me because the video subsystem might not be used at all. So my
question now is if there is a way to initialize event handling without
initializing the video subsystem. Perhaps by calling internal SDL
functions? Can it be done in a way so that it does’nt create problems when
later calling SDL_InitSubSystem(SDL_INITVIDEO)?

Wait, how were you getting an SDL window without using SDL_INIT_VIDEO?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

As I understand it, the idea is to not use an SDL window, but only
SDL surfaces and s/w blitting. A GUI toolkit (in this case, FLTK) is
used to render manually managed shadow surfaces into windows. This
way, there’s no need for an SDL managed display surface, which is how
the single window limit is bypassed. The embedding/integration part
is handled by the GUI toolkit’s image rendering features.

BTW, I’ve used SDL in similar ways for simple image processing tools.
Seems like s/w blitting and stuff works without initializing the
video subsystem, but I’ve only tried it on Linux…

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 26 November 2003 02.45, Sam Lantinga wrote:

I’ve managed to solve the problem. What I did was calling
SDL_Init(0) assuming the event handling subsystems would be
initialized. However it was’nt so I have to call SDL_Init() with
SDL_INITVIDEO. This is not a good solution for me because the
video subsystem might not be used at all. So my question now is
if there is a way to initialize event handling without
initializing the video subsystem. Perhaps by calling internal SDL
functions? Can it be done in a way so that it does’nt create
problems when later calling SDL_InitSubSystem(SDL_INITVIDEO)?

Wait, how were you getting an SDL window without using
SDL_INIT_VIDEO?

I’ve managed to solve the problem. What I did was calling SDL_Init(0)
assuming the event handling subsystems would be initialized. However it
was’nt so I have to call SDL_Init() with SDL_INITVIDEO. This is not a
good solution for me because the video subsystem might not be used at
all. So my question now is if there is a way to initialize event
handling without initializing the video subsystem. Perhaps by calling
internal SDL functions? Can it be done in a way so that it does’nt
create problems when later calling SDL_InitSubSystem(SDL_INITVIDEO)?

Wait, how were you getting an SDL window without using SDL_INIT_VIDEO?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

What I have is a couple of singletons for handling video, keyboard, mouse
etc. The SDL window is created only if the video singleton is instanced
(the constructor of the video singleton calls
SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode() and
SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE), among other things).
SDL_Init(0) is always called at the beginning of the program and
SDL_EventState() is then used to disable all events. I guess this is
causing the problem because the SDL event handling is’nt initialized yet.
So I wonder if there is a way of only initializing the event handling
without initializing the video subsystem… SDL_Init(SDL_INIT_EVENTTHREAD)
does’nt seem to do anything and it’s not portable anyway. Is it a large
overhead of calling SDL_Init(SDL_INIT_VIDEO) even if the video subsystem
is’nt used?On Tue, 25 Nov 2003 17:45:22 -0800, Sam Lantinga wrote:

[…]

Wait, how were you getting an SDL window without using
SDL_INIT_VIDEO?

As I understand it, the idea is to not use an SDL window, but
only SDL surfaces and s/w blitting. A GUI toolkit (in this case,
FLTK) is used to render manually managed shadow surfaces into
windows. This way, there’s no need for an SDL managed display
surface, which is how the single window limit is bypassed. The
embedding/integration part is handled by the GUI toolkit’s image
rendering features.
[…]

Of course, this has nothing whatsoever to do with this thread.
Insufficient caffeine concentration. Sorry 'bout the confusion. :slight_smile:

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 26 November 2003 10.34, David Olofson wrote:

What I have is a couple of singletons for handling video, keyboard, mouse
etc. The SDL window is created only if the video singleton is instanced
(the constructor of the video singleton calls
SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode() and
SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE), among other things).
SDL_Init(0) is always called at the beginning of the program and
SDL_EventState() is then used to disable all events. I guess this is
causing the problem because the SDL event handling is’nt initialized yet.
So I wonder if there is a way of only initializing the event handling
without initializing the video subsystem… SDL_Init(SDL_INIT_EVENTTHREAD)
does’nt seem to do anything and it’s not portable anyway. Is it a large
overhead of calling SDL_Init(SDL_INIT_VIDEO) even if the video subsystem
is’nt used?

Ah, I see. Since you can only get keyboard and mouse input from a window
created by SDL, the event subsystem is only initialized when the video
subsystem is. However, we can certainly initialize the core event queue
separately if it makes sense to do so…

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

What I have is a couple of singletons for handling video, keyboard,
mouse etc. The SDL window is created only if the video singleton is
instanced (the constructor of the video singleton calls
SDL_InitSubSystem(SDL_INIT_VIDEO), SDL_SetVideoMode() and
SDL_EventState(SDL_VIDEORESIZE, SDL_ENABLE), among other things).
SDL_Init(0) is always called at the beginning of the program and
SDL_EventState() is then used to disable all events. I guess this is
causing the problem because the SDL event handling is’nt initialized
yet. So I wonder if there is a way of only initializing the event
handling without initializing the video subsystem…
SDL_Init(SDL_INIT_EVENTTHREAD) does’nt seem to do anything and it’s not
portable anyway. Is it a large overhead of calling
SDL_Init(SDL_INIT_VIDEO) even if the video subsystem is’nt used?

Ah, I see. Since you can only get keyboard and mouse input from a window
created by SDL, the event subsystem is only initialized when the video
subsystem is. However, we can certainly initialize the core event queue
separately if it makes sense to do so…

See ya!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Ok, I see. Thank you for your help. I guess I can live with that.On Wed, 26 Nov 2003 07:55:43 -0800, Sam Lantinga wrote:

[…]

Ah, I see. Since you can only get keyboard and mouse input from a
window created by SDL, the event subsystem is only initialized when
the video subsystem is. However, we can certainly initialize the
core event queue separately if it makes sense to do so…

That would make sense when using SDL as a s/w rendering backend
together with GUI toolkits, I guess. Then you could make fully
interactive SDL “applets” work inside foreign GUI frameworks as well
as in “native SDL mode”, using the same code.

There is a problem with multiple SDL displays using this approach,
though: “Where did that event come from?” One might get away with a
"Context Change" event or something…

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,… |
`-----------------------------------> http://audiality.org -’
http://olofson.nethttp://www.reologica.se —On Wednesday 26 November 2003 16.55, Sam Lantinga wrote: