SFML community forums

Help => Window => Topic started by: SzefRon on January 04, 2022, 04:27:29 am

Title: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: SzefRon on January 04, 2022, 04:27:29 am
Hi, is there any way I could make an sfml window not freeze while I'm fullscreen in other applications?
Running the app as an administrator only fixes the issue partially, but it fixes it fully for the console.
I attached a video showing the problem (I really hope this isn't my recording software's issue. Console doesn't seem to be affected by this and both windows were set up exactly the same way).
First few seconds show both of the windows working as intended (reacting on input), then I enter a fullscreen game and sadly sfml window freezes up while console still works.
Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: eXpl0it3r on January 04, 2022, 09:51:32 am
There isn't a lot of information to go by, as such kind of hard to tell anything.

What's the "console" you talk about exactly?

Make sure you're always processing events and that you only access event members for the given event type.
Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: SzefRon on January 04, 2022, 11:14:10 am
I use sfml 2.4.2 (I use dev-cpp which uses gcc 4.9.2) and by console I mean my application is a console application and I didn't hide the console window (just for debugging). By sfml window I mean the window that gets created by the executable.
I recorded the behaviour of both the console window and the sfml window of my application
and judging from the recording it seems like the sfml window freezes up whenever you go fullscreen on ANOTHER application (it stays on the last frame before going fullscreen and refuses to make any changes to the window. I didn't show that in the recording, but I tested it after).
I should probably mention both the console window and the sfml window aren't minimised, they're just hidden behind the fullscreen game and only the sfml window seems to be unresponsive.

I'm trying to make it still render frames even while being hidden behind a fullscreen application (not minimised). I'm not sure whether that's possible, that's why I'm here. I'm asking whether there's a setting in sfml or whether I could change something in the handling of the sfml window, that could do that for me.
I also used sf::RenderWindow to render the window.
Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: eXpl0it3r on January 04, 2022, 12:45:34 pm
Took a while to understand what you're saying :D

So the SFML window is behind another fullscreen window and it's not updating anymore according to the recording software.

That's kind of expected behavior, by going fullscreen on a display, you give exclusive rendering rights to the fullscreen application. You may also get the window manager deciding if the window that's not visible is updated. And finally the video capturing software's hooks being effected.

You could try using a windowed fullscreen mode and see if that works.
Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: SzefRon on January 04, 2022, 02:11:38 pm
Alright, so the problem doesn't come from sfml,
but why isn't the console window affected by those rendering permissions?

Also, can I somehow grant those rendering permissions to the sfml window inside my code?
If not, how can I operate the window manager to do what I want?
It's really important that it's rendered no matter what!
Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: kojack on January 04, 2022, 06:14:02 pm
I just tried, my SFML based app continued to render fine while I played full screen Dishonored.
Tested both with the app on a second monitor, and with the app on the same monitor behind the full screen game (using OBS to see it still working).
I'm on SFML 2.5.1 though (well, slightly newer, since I got it from the repo).

Title: Re: Unwanted behaviour from sfml window while fullscreen in other applications
Post by: SzefRon on January 04, 2022, 07:24:32 pm
Turns out it was obs' fault! I feel dumb... Oh well.
If you didn't test it, I would probably still be thinking it was my code's fault or something xD
Window capture doesn't like fullscreen...
Thanks a lot! At least I didn't lose my mind while trying to fix it myself!