We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3405 - [Patch] [Windows] Wrong default icon size on windows systems
Summary: [Patch] [Windows] Wrong default icon size on windows systems
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-05 21:55 UTC by Evgeny Vrublevsky
Modified: 2016-10-01 20:17 UTC (History)
0 users

See Also:


Attachments
Patch, default icon is IDI_APPLICATION (32512) (497 bytes, patch)
2016-08-05 21:55 UTC, Evgeny Vrublevsky
Details | Diff
Patch, default icon is IDI_APPLICATION (32512) (2.27 KB, patch)
2016-08-05 21:58 UTC, Evgeny Vrublevsky
Details | Diff
Patch, default icon is SDL_Appname (SDL_app) (2.26 KB, patch)
2016-08-05 22:05 UTC, Evgeny Vrublevsky
Details | Diff
Patch, default icon is the first icon, like in the Explorer (2.38 KB, patch)
2016-08-06 07:12 UTC, Evgeny Vrublevsky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny Vrublevsky 2016-08-05 21:55:51 UTC
Created attachment 2539 [details]
Patch, default icon is IDI_APPLICATION (32512)

Original code in the video/windows/SDL_windowsevents.c registers obsolete WNDCLASS (not WNDCLASSEX). As the result only one icon size is used as the small and normal icons. Also original code doesn't specify required size of an icon. As the result when 256x256 icon is available, the program uses it as a default icon, and it looks ugly.

We have to use WNDCLASSEX and load icons with proper sizes which we can get using GetSystemMetrics.

Also I propose to use IDI_APPLICATION (32512) as the default icon, because it often is used as a default icon. The patch in the attachment already includes this change.
Comment 1 Evgeny Vrublevsky 2016-08-05 21:58:14 UTC
Created attachment 2540 [details]
Patch, default icon is IDI_APPLICATION (32512)

Last time I had uploaded wrong file. This is the right version.
Comment 2 Evgeny Vrublevsky 2016-08-05 22:05:57 UTC
Created attachment 2541 [details]
Patch, default icon is SDL_Appname (SDL_app)

An alternative version. Uses SDL_Appname (SDL_app) as the name of a default icon, like it was before. Bad side of this variant that it is unexpected that changing SDL_Appname requires changing the name of a default icon also. Programmer can forget about it and the window of a game will be without an icon as the result.
Comment 3 Evgeny Vrublevsky 2016-08-06 07:12:20 UTC
Created attachment 2542 [details]
Patch, default icon is the first icon, like in the Explorer

Better idea. We could use the first icon from resources, like the Explorer does. Patch is included. It also correctly loads large and small icons, so it will look nice everywhere.
Comment 4 Evgeny Vrublevsky 2016-08-08 14:04:08 UTC
When you're writing a game using C# (in Visual Studio), it always uses 32512 (IDI_APPLICATION) as the name of an exe icon. It is not easy to change it.

Proposed solution with using of the first icon of an exe file as a default icon of the window will solve this problem, and it will not break compatibility with programs which are using "SDL_APP" as the resource name of an icon.
Comment 5 Sam Lantinga 2016-10-01 20:17:28 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/5c06c3aaca68