Set the icon on window regeneration #3081
Merged
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.
Description
The icon currently gets lost when the window is regenerated. To reproduce:
fullscreen=true
into Dosbox (doesn't work but it still regenerates the window, changing any other setting in the [sdl] group should also suffice).Note, this is probably not reproducible on Mac or MSVC builds as those don't have an empty
SetIcon
function:dosbox-staging/src/gui/sdlmain.cpp
Lines 534 to 544 in e91cae4
The fix is to move the
SetIcon()
call into theset_output
function. This gets called in both the inital startup and when the window gets regenerated. Also moved setting the window title in there for good measure (this gets re-set later anyway to show cycles/ms so it probably doesn't matter much).Manual testing
Confirmed icon and window title are getting set properly and stay set after a window regeneration.
Checklist
Please tick the items as you have addressed them. Don't remove items; leave the ones that are not applicable unchecked.
I have: