Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the icon on window regeneration #3081

Merged
merged 2 commits into from Nov 2, 2023
Merged

Set the icon on window regeneration #3081

merged 2 commits into from Nov 2, 2023

Conversation

weirddan455
Copy link
Collaborator

Description

The icon currently gets lost when the window is regenerated. To reproduce:

  1. Type fullscreen=true into Dosbox (doesn't work but it still regenerates the window, changing any other setting in the [sdl] group should also suffice).
  2. Icon goes missing in both the top left of the window and at the bottom where the open windows are shown. On KDE, it gets replaced by a default Xorg icon.

Note, this is probably not reproducible on Mac or MSVC builds as those don't have an empty SetIcon function:

/* On macOS, as we use a nicer external icon packaged in App bundle.
*
* Visual Studio bundles .ico file specified in winres.rc into the
* dosbox.exe file.
*
* Other OSes will either use svg icon bundled in the native package, or
* the window uploaded via SDL_SetWindowIcon below.
*/
#if defined(MACOSX) || defined(_MSC_VER)
static void SetIcon() {}
#else

The fix is to move the SetIcon() call into the set_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:

  • followed the project's contributing guidelines and code of conduct.
  • performed a self-review of my code.
  • commented on the particularly hard-to-understand areas of my code.
  • split my work into well-defined, bisectable commits, and I named my commits well.
  • applied the appropriate labels (bug, enhancement, refactoring, documentation, etc.)
  • checked that all my commits can be built.
  • confirmed that my code does not cause performance regressions (e.g., by running the Quake benchmark).
  • added unit tests where applicable to prove the correctness of my code and to avoid future regressions.
  • made corresponding changes to the documentation or the website according to the documentation guidelines.
  • locally verified my website or documentation changes.

@weirddan455 weirddan455 added the bug Something isn't working label Nov 2, 2023
@weirddan455 weirddan455 self-assigned this Nov 2, 2023
Copy link
Member

@kcgen kcgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(just a small suggestion)
Nice catch, @weirddan455 !

@weirddan455 weirddan455 merged commit 082a00f into main Nov 2, 2023
50 checks passed
@weirddan455 weirddan455 deleted the wd/icon branch November 2, 2023 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants