Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: strange fullscreen behavior  (Read 2772 times)

0 Members and 1 Guest are viewing this topic.

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
strange fullscreen behavior
« on: October 16, 2015, 04:16:10 pm »
I found some strange behavior with using fullscreen mode.
When I open app in the full screen, then switch it to windowed mode, the screen is blinking on app closing. It seems like video mode switch. It's strange, because app is already switched to window mode, so it should restore original video mode when I switched it to windowed mode, but it doing it on app close.
What happens exactly with display on app close and how to eliminate such blinking?

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: strange fullscreen behavior
« Reply #1 on: October 16, 2015, 04:36:16 pm »
It happens in all apps when you switch from fullscreen to windowed mode, that is because technically when app is giong fullscreen it gets device handle and draws to it the device handle is link to monitor itself that means that app in some case "takes over" the screen and instead of os rendering starts the apps rendering when screen blinks it some kind of unhandling - e.g. getting back screen right of reandering setting everything back and other stuff :)

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: strange fullscreen behavior
« Reply #2 on: October 17, 2015, 02:21:48 am »
When it happens at the time of change fullscreen->windowed it's OK.
But it happens at the time of call window.Close() and not at the time of window.SetVisible(false), so it raises blinking even for windowed mode.
When user switching to the windowed mode, I'm calling to SetVisible(false) and using another RenderWindow instance for windowed mode.
But when the user closes app, I'm call to window.Close for all instances, so it causes blinking even in windowed mode. And this is a problem.

If it possible to fix it and save ability to enter fullscreen mode faster with SetVisible(true) it should be fixed.
In case if such fix will raise longer switch to fullscreen mode with SetVisible(true), it's better to leave it as it with remark about such limitation.
« Last Edit: October 17, 2015, 02:35:45 am by mkalex777 »

Mr_Blame

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • Email
Re: strange fullscreen behavior
« Reply #3 on: October 17, 2015, 08:08:52 am »
It better to "recreate" window instrad of hiding it. Here is example:
//you created a window in gullscreen mode and you need windowed now.(window variable is sf::RenderWindow instance)
window.close();
windoe.create(/*arguments*/);
 

mkalex777

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: strange fullscreen behavior
« Reply #4 on: October 17, 2015, 01:05:06 pm »
I know how to recreate, but I don't need it, I store existing window for fast switch to fullscreen mode. Recreate is too slow. It's better to use it with single time bliking on app close, than recreate it on each fullscreen switch :)

But it's strange, because I'm using the same desktop mode in fullscreen, so there is no need to change video mode.
« Last Edit: October 17, 2015, 01:08:34 pm by mkalex777 »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: strange fullscreen behavior
« Reply #5 on: October 17, 2015, 01:40:57 pm »
Then you'd be better of with a borderless window instead.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/