Ahoy there!
I recently had to work around item 3 from
this thread, where a borderless fullscreen window created via
sf::Style::None would not be positioned over the top of launcher bars, status menus and desktop margins in Gnome, KDE, XFCE, and Cinnamon (and probably more). Attached are some screenshots demonstrating various behaviours in various WMs.
After diving down the rabbit hole a bit and doing a bunch of research, I was able to implement something that achieved what I was after without resorting to FSEM (Fullscreen Exclusive Mode), that I've been able to confirm as working with the previously mentioned WMs/DEs.
Best practices for most broadly compatible borderless fullscreen windows seem to include setting
_NET_WM_STATE_FULLSCREEN (currently not done for
sf::Style::None because
sf::Style::None is used for more than just borderless fullscreen windows). In addition to this, the window needs hints saying that it's resizeable
before _NET_WM_STATE_FULLSCREEN is set (and then changed to be non-resizeable after) thanks to the fussiness of some window managers. Without these states and hints set in the right order, the WM (Some WMs? Many WMs? All WMs? Who knows) is free to reposition and resize the window to fit the space available to non-fullscreen windows.
The attached patch changes the
WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings) function. It uses the existing
sf::Style::Resize resize hints for
sf::Style::None, calls
switchToFullscreen() when
sf::Style::None is used, and moves the "hack" to disable resizing to the end of the function so that it's after
switchToFullscreen() calls.
Since the game I'm working on doesn't use
sf::Style::None for anything but borderless fullscreen windows, that meets our needs. SFML provides
sf::Style::None for other purposes, and so in its current form, I wasn't comfortable opening a pull request. It's also likely to conflict with the work in
PR #1238, which appears to focus mostly on FSEM (though what I've learned while writing this patch may still be relevant there).
I am open to improving this patch to a point where it could be merged, but I feel like I won't have time for that in the near future. It's better to share than hoard though, so here it is ^_^