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

Author Topic: Windowed fullscreen (a.k.a borderless fullscreen window)  (Read 6568 times)

0 Members and 1 Guest are viewing this topic.

hobby

  • Newbie
  • *
  • Posts: 43
    • View Profile
Windowed fullscreen (a.k.a borderless fullscreen window)
« on: November 12, 2016, 08:10:34 am »
In order to switch between windowed and 'windowed fullscreen' (EDIT: also known as 'borderless fullscreen window') modes, I tried to re-call Window::create(), toggling between passing sf::Style::None + sf::VideoMode::getDesktopMode() and passing sf::Style::Default with the previously-saved window size.
  • Is it the recommended practice?
  • In Linux, the switch caused all letters to become white rectangles-of-some-sort, I had to reload all fonts to fix that. Windows did not seem to have this problem.
    Is it normal or something wrong on my side?
    Update: this seems to be specific to VirtualBox HW acceleration, unrelated to SFML.
  • In Ubuntu Linux, there's that launcher at the left side of the screen, and the windowed-fullscreen window appeared next to it so the right side of the window went out of the screen.
    How do I make the window cover that launcher, or alternatively, is there any way to return the working area (in contrast to getDesktopMode() that returns the full resolution)?
    Update: this is an issue in Ubuntu Unity, unrelated to SFML (see below).
  • In Windows, Alt-tabbing in windowed fullscreen mode out of the SFML window sometimes resulted in the screen becoming black, with its content gradually appearing following the mouse cursor.
    When I tried this code + calls to sf::Window::setSize() so that SFML was aware of the new size, this problem disappeared.
    Is it a known problem?

My configuration: desktop with one monitor, Win 7-64 & NV GPU (Aero disabled), Ubuntu 16.04 in a VM (HW accelerated).
SFML version: 2.4 with XCB removal commit.
« Last Edit: December 02, 2016, 01:28:22 pm by hobby »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Windowed fullscreen
« Reply #1 on: November 12, 2016, 10:52:32 am »
So do you want fullscreen mode or a borderless fullscreen window?

For the first one you need to use sf::Style::Fullscreen. For the later you probably want to manually set the window position to (0, 0).

Fonts shouldn't be "invalidated", unless you do something strange in your code.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

hobby

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Windowed fullscreen
« Reply #2 on: November 12, 2016, 01:22:14 pm »
By 'windowed fullscreen' I was referring to borderless fullscreen window. I'll edit the post to make it clearer.
Adding window.setPosition(sf::Vector2i(0, 0)) did not seem to solve problem (3) above.

Here's the code:
m_isWindowedFullscreen = !m_isWindowedFullscreen;
if (m_isWindowedFullscreen) {
        m_prevWindowWidth = window.getSize().x;
        m_prevWindowHeight = window.getSize().y;
        m_prevWindowPosX = window.getPosition().x;
        m_prevWindowPosY = window.getPosition().y;
        window.create(sf::VideoMode::getDesktopMode(), getWindowTitle(),
                sf::Style::None, getIdealContextSettings());
        window.setPosition(sf::Vector2i(0, 0));
} else {
        assert(m_prevWindowWidth != -1);
        window.create(sf::VideoMode(m_prevWindowWidth, m_prevWindowHeight), getWindowTitle(),
                sf::Style::Default, getIdealContextSettings());
        window.setPosition(sf::Vector2i(m_prevWindowPosX, m_prevWindowPosY));
}

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Windowed fullscreen (a.k.a borderless fullscreen window)
« Reply #3 on: November 12, 2016, 02:58:29 pm »
So is the window created behins the unity launchbar or is it setup beside the bar?
Looking around the web, it seems that this is generally an issue with borderless fullscreen and the unity lauchbar. I've seen some fixes involving changing some.compwiz settings, try googling for it.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

felaugmar

  • Guest
Re: Windowed fullscreen (a.k.a borderless fullscreen window)
« Reply #4 on: November 12, 2016, 06:25:16 pm »
Interesting this 'behavior', I did the changes as in here : https://ubuntuforums.org/showthread.php?t=1848739&p=11606441#post11606441, works pretty fine.
It's not a thingy that you need to change in code, it's unity peculiarity.

hobby

  • Newbie
  • *
  • Posts: 43
    • View Profile
Re: Windowed fullscreen (a.k.a borderless fullscreen window)
« Reply #5 on: December 02, 2016, 01:24:39 pm »
Thanks, you were both right, issue (3) is indeed in Ubuntu Unity, unrelated to SFML.
As for issue (2), it seems to be specific to VirtualBox HW acceleration, probably re-creating the window invalidates all the textures created by the previous window. So this is not connected with neither SFML nor my code.
What remains is issue (4), which looks real but I already have a workaround for.