SFML community forums

Help => Window => Topic started by: Aceeri on June 11, 2015, 03:04:30 am

Title: Tabbing out
Post by: Aceeri on June 11, 2015, 03:04:30 am
I'm trying to figure out how to correctly handle minimizing the window when Alt-Tabbing out of the window when it is using sf::Style::Fullscreen. When I do it right now it stays the same resolution as the resolution of the window when I want it to go back to the default resolution. How could I achieve this?
Title: Re: Tabbing out
Post by: Hapax on June 11, 2015, 09:26:20 pm
Are you saying that the desktop resolution stays at the resolution of your application when ALT-TABbing from it and you want it to go back to the original desktop resolution?

If so, you could try intercepting the ALT+TAB key combination and switching it back from fullscreen to a window.

Could you try this code and let me know what results you get?:
(click to show/hide)

You can also use events to make this simpler. Just recreate the window without fullscreen when the window loses focus (http://www.sfml-dev.org/documentation/2.3/classsf_1_1Event.php#af41fa9ed45c02449030699f671331d4aabd7877b5011a337268357c973e8347bd).
Restoring fullscreen on regaining window focus doesn't seem to work. Might be an SFML bug (http://en.sfml-dev.org/forums/index.php?topic=18371.0)...


NOTE: You should be aware that this is rather Windows specific (the whole question). You'd want to test for other key combinations to make your code more portable.