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

Icons corruption on macOS ventura #1218

Closed
Mattoje opened this issue Oct 1, 2023 · 5 comments
Closed

Icons corruption on macOS ventura #1218

Mattoje opened this issue Oct 1, 2023 · 5 comments
Labels

Comments

@Mattoje
Copy link
Contributor

Mattoje commented Oct 1, 2023

On macOS ventura 13.6 slot icons do not display properly

screenshot here:

Screenshot 2023-10-01 at 23 37 42

VeraCrypt version 1.26.7

@Mattoje Mattoje added the bug label Oct 1, 2023
@Jertzukka
Copy link
Contributor

It looks like only the top part that should be hidden by the bitmap mask is the only part visible. The code regarding this hasn't been touched since 9 years, so the culprit would most likely be the upgrade of wxWidgets to the latest Stable.

It looks like there has been a change in how wxWidget's OSX version handles the mask (see wxWidgets/wxWidgets@8403b79), so when we create the bitmap mask, we probably need to separate this part for OSX and change it to (image.ConvertToMono (255, 255, 255), 1) possibly?

# ifdef __WXGTK__
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);

Unfortunately I don't have a MacOS system to test and troubleshoot this further.

@Mattoje
Copy link
Contributor Author

Mattoje commented Oct 3, 2023

i'm able to compile it for macOS and i can test it.

If you post here a patch i can try it

@Jertzukka
Copy link
Contributor

This is my (un)educated guess on the fix:

diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index d9a787a5..e65b5026 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -190,7 +190,11 @@ namespace VeraCrypt
 		image.Resize (wxSize (16, 12), wxPoint (0, 0));
 
 #	ifdef __WXGTK__
+#		ifdef TC_MACOSX
+		return wxBitmap (image, 1);
+#		else
 		return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
+#		endif
 #	else
 		return wxBitmap (image);
 #	endif

Copy this into a text file, save it as mask.patch and run git apply mask.patch in the git root. I appreciate if you're able to compile and test the patch to see whether it works.

@Mattoje
Copy link
Contributor Author

Mattoje commented Oct 3, 2023

It does not work and i think it's because WXGTK is a linux-only thing.
Given my limited c++ skills here is an "it works for me" fix

diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index d9a787a5..58030c1e 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -189,7 +189,7 @@ namespace VeraCrypt
                wxImage image (stream);
                image.Resize (wxSize (16, 12), wxPoint (0, 0));
 
-#      ifdef __WXGTK__
+#      if defined  __WXGTK__ || defined TC_MACOSX
                return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
 #      else
                return wxBitmap (image);
Screenshot 2023-10-03 at 19 14 30

@idrassi
Copy link
Member

idrassi commented Oct 3, 2023

Thank you @Jertzukka for pinpointing the problematic code. And kudos to @sardanap for refining and testing the patch! This is teamwork at its finest 👍

It appears that earlier versions of wxWidgets had platform-specific behaviors between Linux and macOS. Now they've standardized their implementation across all platforms and so this regression happened.

@sardanap: would you kindly create a PR with your fix?

@Mattoje Mattoje closed this as completed Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants