-
Notifications
You must be signed in to change notification settings - Fork 567
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
Windows: Allow setting a window Icon #1162
Comments
As a hint I guess this SO awnser for C should give a starting point https://stackoverflow.com/a/45727762/4929236 |
This seems to show the missing pieces in winapi-rs retep998/winapi-rs#122 Seems like https://github.com/linebender/druid/blob/master/druid-shell/src/platform/windows/window.rs#L1209 needs to construct WNDCLASSEXW from scratch instead of using that function as that function does not expose hIcon to us |
An alternative is to load it after creating the window using https://docs.rs/winapi/0.3.9/winapi/um/winuser/fn.LoadImageW.html |
Taken from the zulip chat (Just to track it here):
|
We definitely want to be able to customize the app icon on all platforms. At least in the mac case this is mostly a case of just putting a file with the right name in the right place in the app bundle, and including it in the |
Setting the desktop icon on Windows similarly requires storing the icon in the application's manifest, which is analogous to |
@raphlinus thats easily done using the above linked winres and a build.rs :) That already works |
The tracking issue for such files and their handling is #397 |
Very cumbersome method |
I've gotten window icons set up when building for Windows, in my project. I thought I'd share my findings here along with the relevant code, to aid anyone who wants to implement this before Druid officially supports it. Here's a screencap of the titlebar: And in the Alt+Tab dialog: (the Windows API supports setting different icons for Alt+Tab than for window titlebars, though I set the same for both here) Below is the pertinent code. There's a few considerations, however:
Useful links I found when looking into this:
I haven't worked with MacOS or Linux as of yet as GUI support for my project is still in it's early stages, but if I come up with a solution for any other platforms that I'm happy with I'll mention it here. |
It would be nice to set a Window Icon which shows both in the title bar and in the taskbar.
For the exe itself https://github.com/mxre/winres does work fine. For the Window itself this is not yet clear.
The text was updated successfully, but these errors were encountered: