Skip to content

Allow more customization/flexibility in windowed mode (vid_borderless, vid_ignore_taskbar, vid_mouse_clickthrough)

nico requested to merge incognico/darkplaces:vid_borderless into master

Addresses #196 (closed)

My initial goal was just to make the W10 Game Bar Overlay work, that only works when a game is in "fake-fullscreen borderless windowed mode". This probably only seems to be true for DirectX games and not for OpenGL ones. The problem is Windows itself - as soon as Windows detects a windowed 3rd party game which is borderless and has the same resolution as the desktop, it applies magic ™️ and puts it in this state where it appears like fullscreen but it is not. Aaand then game bar won't work because the game is now in fullscreen for Windows. 🤦 Yes, subtracting one pixel form width or height would make it work.

This MR adds:

  1. vid_borderless cvar

Removes window decorations on any OS. Default disabled.

  1. vid_ignore_taskbar cvar

This one is Windows OS specific and makes windowed mode placement/size bypass the code added in 382a7a71

This was necessary because the only way to get Windows to overlay stuff (game bar, volume panel) is to have a window with decorations and the same size as the desktop resolution but the border pushed outwards of the visible screen. As of the mentioned commit this is not possible to achieve anymore - with the behavior before that commit, there would not have been a issue. Default disabled.

  1. vid_mouse_clickthrough cvar

Sets the hint SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, if enabled this can further improve overlay compatibility. Also a matter of personal taste, click-to-focus vs. clickthrough. Default disabled.

  1. Fixed a few compiler warnings in AdjustWindowBounds()

I have tested all kinds of combinations of vid_fullscreen, vid_desktopfullscreen, vid_borderless, vid_ignore_taskbar and vid_resizable and it seems fine to me.

TL;DR: 3 new cvars, see code, please review and test, any feedback is appreciated.

Edited by nico

Merge request reports