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

add windows icon #111

Merged
merged 4 commits into from
Feb 29, 2024
Merged

add windows icon #111

merged 4 commits into from
Feb 29, 2024

Conversation

mrbesen
Copy link
Contributor

@mrbesen mrbesen commented Feb 21, 2024

I added the stuff required to give the exe file an icon.

The problem: It increases the filesize from 69.1kB to 208.4kB - Wtf?
I dont know if thats worth for you. Maybe you want to provide both, a icon exe file and an non icon exe file?
It might be possible to reduce the exe filesize by removing some icon resolutions. I don't know which are required.

@mrbesen mrbesen marked this pull request as ready for review February 21, 2024 16:01
@dreua
Copy link
Member

dreua commented Feb 21, 2024

I don't care about the file size its still probably the smallest application I'd use on windows. But that is on @cnlohr to decide.

The ci fails here, probably needs to run the icon building prior to the exe building. Should be fixable in Makefile.

@dreua
Copy link
Member

dreua commented Feb 21, 2024

I always think icons are an improvement BTW 👍

@mrbesen
Copy link
Contributor Author

mrbesen commented Feb 22, 2024

I have removed all icon sizes except 128px and 32px. But i dont know if windows requires some sizes inbetween for correct display. But the binary is now "only" 140kB

Copy link
Member

@dreua dreua left a comment

Choose a reason for hiding this comment

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

Lgtm, not tested in Windows yet

@cnlohr
Copy link
Member

cnlohr commented Feb 22, 2024

I don't see the actual .ico file in this CL.

@dreua
Copy link
Member

dreua commented Feb 22, 2024

I don't see the actual .ico file in this CL.

Its generated from the svg by Makefile instructions, looks like this. It's good enough to be something distinctive and doesn't look broken :)

@cnlohr
Copy link
Member

cnlohr commented Feb 22, 2024

Please also check it in as an artifact

@mrbesen
Copy link
Contributor Author

mrbesen commented Feb 23, 2024

I have now manually compressed the icon using Gimp. The ico is now only 1.7kB!
I did not find an appropriate imagemagick command to do the same thing. So i just commited the compressed ico file to the repo and wrote the steps i took to compress the image in the Makefile.

On my windows11 system the created exe with icon looks great. But gimp warns about using compression. Maybe older windows systems have problems with that. What's the oldest windows we want to support? If windows is not able to load the compressed icon would the application still work? I can check if i have an winXP or Win7 vm where i can test that.

EDIT:

I tested it on winXP and win7 vms.

winXP:

the icon is not displayed in the compressed version, but cnping does not work at all.
It only creates this error:

cnping.exe - Entry Point Not Found
The procedure entry point RegGetValueA could not be located in the dynamic link library ADVAPI32.dll.

win7:

The icon is displayed in compressed and uncompressed forms. cnping does start, but is crashing after creating the window. I belive its the same bug as in #83 .
But i guess it doesnt matter for this PR, as the icon does not make anything worse than it is without.

@dreua

This comment was marked as outdated.

Makefile Outdated
@@ -33,7 +33,7 @@ cnping-wingdi.exe : cnping.c ping.c httping.c resources.o
cnping.exe : cnping.c ping.c httping.c resolve.c resources.o
$(MINGW32)gcc -g -fno-ident -mwindows -m32 -DCNFGOGL $(CFLAGS) -o $@ $^ -lgdi32 -lws2_32 -s -D_WIN32_WINNT=0x0600 -DWIN32 -liphlpapi -lopengl32 -DMINGW_BUILD $(ADMINFLAGS)

resources.o : resources.rc
resources.o : resources.rc cnping.ico
Copy link
Member

Choose a reason for hiding this comment

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

As we are now committing this file, I'd say we shouldn't require it here to avoid confusion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have removed it by editing the commit
from e4c2dc6
to fix ci; reduce amount of resolutions

@dreua
Copy link
Member

dreua commented Feb 23, 2024

Never mind my comment about artifacts, you already removed that part again in the last commit 👍

@cnlohr
Copy link
Member

cnlohr commented Feb 28, 2024

I am good with this at this point. @dreua do you feel it's ready?

@dreua
Copy link
Member

dreua commented Feb 28, 2024

Haven't tested it myself but I trust mrbesen's tests, ready to merge from my side.

@cnlohr cnlohr merged commit 2498fa4 into cntools:master Feb 29, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants