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

Author Topic: Borderless Windowed Fullscreen  (Read 10063 times)

0 Members and 1 Guest are viewing this topic.

Anasky

  • Newbie
  • *
  • Posts: 20
    • View Profile
Borderless Windowed Fullscreen
« 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( );

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Borderless Windowed Fullscreen
« Reply #1 on: October 04, 2017, 03:19:18 pm »
How do you notice that it's full screen?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Anasky

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #2 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Borderless Windowed Fullscreen
« Reply #3 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?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Anasky

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #4 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

billarhos

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #5 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);
 

« Last Edit: October 11, 2017, 10:36:41 pm by billarhos »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Borderless Windowed Fullscreen
« Reply #6 on: October 12, 2017, 12:36:26 am »
Can you explain what you changed in the code?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

billarhos

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #7 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Borderless Windowed Fullscreen
« Reply #8 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

billarhos

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #9 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

billarhos

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #10 on: October 12, 2017, 07:45:20 pm »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Borderless Windowed Fullscreen
« Reply #11 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

billarhos

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: Borderless Windowed Fullscreen
« Reply #12 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
« Last Edit: October 12, 2017, 09:25:57 pm by billarhos »