I am using OpenFl to target Windows and I need my application to be always in front (because it’s a public application in a Museum)…I used to do this with nativeWindow.alwaysInFront = true in Adobe Air…is there any equivalent in OpenFL ?
More over, I create sometimes multi-screens applications…is there any way to open a window on a given monitor, like in Adobe Air ?
Multi-window support is not heavily used, but you should be able to use <window id="1" width="800" height="600" /> to define a second window (there are some runtime ways to do it too)
The <window /> has a display attribute that is also not often used, but I’d be happy to hear feedback – it should request a window on the display index used, rather than the default
SDL is our native C library we use for window creation on the desktop, it has SDL_WINDOW_ALWAYS_ON_TOP it looks like (https://wiki.libsdl.org/SDL_WindowFlags) but I’m not sure we have that exposed. I’m sure this would not be too hard to expose, or patch into the source manually
This required some improvements to SDL2, SDL_WINDOW_ALWAYS_ON_TOP was implemented for X11 (Linux) but not Windows, but I was able to add support in my own copy. I’m seeing if we can get this contributed back to SDL official.
Yep, if it’s stable it will go out in a future release of Lime
The code was forcing on top if full screen and input focused, but I suppose that it would have allowed it to fall behind if the full screen window did not have focus.
The changes I made should override that if “always on top” is set. The only problem is that you cannot toggle it on/off at runtime currently, or maybe there’s a way
Hm, i’m testing this with Lime 4.1.0 and OpenFL 5.0 but im not getting the expected results.
I see no change from Lime 4.9.2 ; the window is not staying on top at all.. Im using Win10.
Tested both windowed mode and fullscreen.
And the property is not accessible from code, just from the project.xml right?
Thanks for the fix!
Now it works, in window mode and while fullscreen mode has focus.
I did some work a while ago trying to find a good always-on-top solution for fullscreen.
When the app focus is lost, the application minimizes and doesnt stay on top. Pressing the win key, opening task manager or simply clicking on another window on a different screen will make the fullscreen app minimize.
I couldn’t find a good solution to this, except running in non-fullscreen mode just creating a chromeless window at the size of the screen. But this is not a great solution, and there are some framerate issues when running in non-fullscreen mode sometimes.
I’m not sure, the OS might be designed to allow focus to be removed from a fullscreen window by design. When implementing this feature, I did notice the difference between “the current thread has to have priority” in order to execute certain commands (or something along those lines)
My gaming keyboard has a mode to disable the Windows start button for a reason
I think the AIR runtime has little bits written in plain GDI for win32, which allows them to process Windows messages - specifically the one dealing with focus lost. If the focus is lost, they probably just veto the event, or reset the focus (and topmost window) to be their hosted view.
There’s probably a way to patch it into your codebase using the untyped(c++) macros, but it’s slow going and may cost you too much time. A good first step is to set your window like so: