SFML community forums

Help => Window => Topic started by: Anasky on October 04, 2017, 01:39:23 pm

Title: Borderless Windowed Fullscreen
Post by: Anasky on October 04, 2017, 01:39:23 pm
Heya all,

I managed to get a borderless window up and running, but the application turns into Fullscreen mode when creating it rather than the intended fullscreen windowed.. How can I set it up so that it becomes fullscreen windowed? I'm on Windows 7, if that matters.

The window is made using the following code:
Code: [Select]
m_ScreenWidth = 1920;
m_ScreenHeight = 1080;
m_WindowMode = sf::VideoMode( m_ScreenWidth, m_ScreenHeight );
m_Title = "Brawler";
m_ContextSettings = sf::ContextSettings( 24U, 8U, 4U, 4U, 0U, sf::ContextSettings::Attribute::Default );
m_Style = sf::Style::None;
m_Window = new sf::Window( );
m_Window->setVerticalSyncEnabled( true );
m_Window->create( m_WindowMode, m_Title, m_Style, m_ContextSettings );
m_Window->setPosition( sf::Vector2i( ( m_ScreenWidth - m_WindowMode.width ) / 2, ( m_ScreenHeight - m_WindowMode.height ) / 2 ) );
m_Window->setActive( true );
Resize( );
clsOpenGL::CheckOGLerror( );
m_WindowHandle = m_Window->getSystemHandle( );
Title: Re: Borderless Windowed Fullscreen
Post by: eXpl0it3r on October 04, 2017, 03:19:18 pm
How do you notice that it's full screen?
Title: Re: Borderless Windowed Fullscreen
Post by: Anasky on October 04, 2017, 03:39:03 pm
The screen flickers when the application starts up, and you can't go back to the screen like you normally could when it's windowed.
Title: Re: Borderless Windowed Fullscreen
Post by: eXpl0it3r on October 04, 2017, 03:43:22 pm
You can't go back to the screen like you normally could when it's windowed.
What do you mean with that exactly?

What GPU do you have?
Title: Re: Borderless Windowed Fullscreen
Post by: Anasky on October 04, 2017, 03:49:54 pm
I'm guessing it's an internal error in my update loop which only triggers during fullscreen mode.
The flickering is an indicator to me that it's going fullscreen (or at the very least, isn't staying a window. This seems to be verified by the fact that it doesn't do this if I change the resolution to anything other than 1920x1080).

My GPU is: AMD Radeon R7 M370
Title: Re: Borderless Windowed Fullscreen
Post by: billarhos on October 11, 2017, 10:08:22 pm
hi
you can check my code for fullscreen borderless (fullscreen non exclusive)

http://www.mediafire.com/file/zfkw03h3frbvh1p/SFML-2.4.2_borderless.rar

do not forget to backup your files first :)

example usage
window.create(sf::VideoMode(1920, 1080), "My Game", 16, contextSettings);
 

Title: Re: Borderless Windowed Fullscreen
Post by: eXpl0it3r on October 12, 2017, 12:36:26 am
Can you explain what you changed in the code?
Title: Re: Borderless Windowed Fullscreen
Post by: billarhos on October 12, 2017, 01:11:58 pm
Is it better for you, if i create a git hub branch  or to write down the changes i made?
I am using this code for more than year without a problem.
Title: Re: Borderless Windowed Fullscreen
Post by: eXpl0it3r on October 12, 2017, 01:17:54 pm
Well I'm not quite sure what your modification solve, but yeah, if you had it on GitHub, then it could be more easily compared through diff.
Title: Re: Borderless Windowed Fullscreen
Post by: billarhos on October 12, 2017, 01:35:59 pm
Well my modification did not solve any problem, my modification is an addtion to sfml features.

enum
    {
        None       = 0,      ///< No border / title bar (this flag and all others are mutually exclusive)
        Titlebar   = 1 << 0, ///< Title bar + fixed border
        Resize     = 1 << 1, ///< Title bar + resizable border + maximize button
        Close      = 1 << 2, ///< Title bar + close button
        Fullscreen = 1 << 3, ///< Fullscreen mode (this flag and all others are mutually exclusive)
        FullscreenBorderLess = 1 << 4, ///< Fullscreen mode borderless
        Default = Titlebar | Resize | Close ///< Default window style
    };
 

as soon as i find little time i create a branch. maybe in this afternoon
Title: Re: Borderless Windowed Fullscreen
Post by: billarhos on October 12, 2017, 07:45:20 pm
Here is my code:
https://github.com/Billarhos/SFML (https://github.com/Billarhos/SFML)
Title: Re: Borderless Windowed Fullscreen
Post by: eXpl0it3r on October 12, 2017, 08:34:12 pm
Okay, so you don't really change anything, but just provide another styling enum and set the window to fullscreen without decorations.

This can already be done without modifying SFML and is not what the reported issue here is about.

The issue is, that when the window matches the screens resolution and has not decorations, Windows sometimes/somehow decides to switch into exclusive mode on Windows.
Another suspicion I have, that this is some behavior caused by the AMD driver, but for that we'll need a larger report sample.

SFML doesn't request exclusive mode, so I don't know yet how or why the switch happens and what options exist to prevent it.
Title: Re: Borderless Windowed Fullscreen
Post by: billarhos on October 12, 2017, 09:14:15 pm
Well ok i understand. But maybe this code will help to make a fullscreen borderless window without turning to exclusive fullscreen without reason.

Cheers