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.
This fixes #1410 (the line coordinates, but unfortunately not the red flicker).
The issues I believe is that acknowledge_resize_display_win_main_thread gets run on the main thread and so setup_gl inside of it does not work properly as the main thread can't access the TLS variables from the thread with the user's main() function.
I moved setup_gl(d); out of that function and just call it from both acknowledge_resize_display_win and resize_display_win instead, on whichever thread those are called from. It seems to fix both resizing a window with the handle as well as using al_resize_display to resize it.
The reason resizing is not completely broken without this PR is that calls to al_draw_bitmap can also repair the opengl viewport so in most cases the viewport would only be wrong for a frame or two after a resize but then eventually things would work again.
I also moved another call of _al_ogl_setup_gl to after [context update] which seems to make more sense and removed a superfluous _al_ogl_resize_backbuffer call (it gets called inside _al_ogl_setup_gl anyway). And I added the display dimensions to some of the log messages.