Make Alt+Tab work correctly when in fullscreen #1426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using WS_EX_TOPMOST on a fullscreen window prevents Alt+Tab from switching to any different window. This is a bit of an annoyance as it ruins the point of Alt+Tab, especially in the case of a non-exclusive mode being set. It however is very very bad in any case ares hangs, and thus prevents being able to switch to Task Manager to actually kill ares. This means the average user could potentially run into a situation requiring them sign out or shutdown their PC, and thus potentially lose data in other apps.
It also happens to be the case that if the user attempts to Alt+Tab while in exclusive fullscreen, ares will hang for whatever reason. This commit doesn't fix that hang, but it does at least allow the user to Alt+Tab out of the situation.
Note that the windows are being set with WS_DISABLED more to avoid what I believe is a Windows bug. Normally WS_EX_NOACTIVATE should prevent clicking on the window from actually activating the window. However, if you were to Alt+Tab to some other window, then have that other window being shunk so ares ends up shown, you can proceed to click on the ares window, and it will actually activate that window. This thus takes focus away from ares' presentation window with generally no way to give it focus (assuming inputs get blocked). WS_DISABLED prevents mouse input from working on the fullscreen window (which it normally doesn't do anything due to WS_EX_NOACTIVATE, only in the weird case I laid out does it do something)
Also this commit likely breaks macOS/Linux (haven't tested / can't test those), probably need to check for focus differently depending on platform defines?