SDL Device correctly processing events?

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

SDL Device correctly processing events?

Postby despair » Sat Aug 19, 2017 11:04 pm

Is the Irrlicht SDL device binding correctly processing input/window focus events? I am unable to get it to stop rendering when the focus is released, or when the window is minimised.

How to reproduce: create any irrlicht device using type EIDT_SDL, and insert code that occurs when device->isWindowActive() or device->isWindowMinimized().

Expected: when the device window loses focus, the loop falls through to the next code that occurs when the window is NOT active. When the device is minimised, the loop additionally jumps to the code when the device is minimised.

Actual: I cannot break out of the regular device rendering loop; i.e. the device thinks it's always active and in focus.

???
despair
 
Posts: 1
Joined: Wed Aug 16, 2017 7:27 am

Re: SDL Device correctly processing events?

Postby CuteAlien » Sun Aug 20, 2017 1:57 am

Phew, I've only started working with SDL device a little bit very recently and original coder long gone. From code (CIrrDeviceSDL.cpp) it looks like it tries to handle it at least:
cpp Code: Select all
 
case SDL_ACTIVEEVENT:
    if ((SDL_event.active.state == SDL_APPMOUSEFOCUS) ||
            (SDL_event.active.state == SDL_APPINPUTFOCUS))
        WindowHasFocus = (SDL_event.active.gain==1);
    else
    if (SDL_event.active.state == SDL_APPACTIVE)
        WindowMinimized = (SDL_event.active.gain!=1);
    break;
 


isWindowActive returns "WindowHasFocus && !WindowMinimized);" and isWindowFocused and isWindowMinimized return the corresponding variables.

That seems to be all code about this. Not sure if it's enough or would need to handle any other events. Might also depend on platform somewhat (for example I use SDL in webbrowser/emscripten which does not always work exactly the same as SDL on desktop).
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8276
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 1 guest