Possible bug with Systray and transparency

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
mrbungle
Enthusiast
Enthusiast
Posts: 143
Joined: Wed Dec 30, 2020 3:18 am

Possible bug with Systray and transparency

Post by mrbungle »

I don't think the AddSysTrayIcon and ChangeSysTrayIcon commands support template images on macOS. This means that sometimes, the wrong icon / icon color is shown depending if Dark Mode and/or transparency is used.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Possible bug with Systray and transparency

Post by Fred »

Could you post a small snippet ?
mrbungle
Enthusiast
Enthusiast
Posts: 143
Joined: Wed Dec 30, 2020 3:18 am

Re: Possible bug with Systray and transparency

Post by mrbungle »

Thanks for responding, Fred. I don't have code to post, but can illustrate:

https://ibb.co/Tmd68Fg

The white icon in the menu bar is a PNG file loaded in dark mode while using a transparent menu bar when using the Addsystray and Changesystray commands. It should be dark like the rest of the icons since macOS will detect the current theme and use the PNG asset's mask.

However, if a system menu is built manually using CocoaMessage commands (without using the Systray). For example, CocoaMessage(0,ImageID(0),"setTemplate:",#True), the same icon would display correctly (dark) because macOS will use its mask because it will be treated as a template per https://developer.apple.com/documentati ... ppearances

Systray is preferable for many situations because it generates a proper event and the commands do a lot of things to make life easy.

Hopefully, this makes sense.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Possible bug with Systray and transparency

Post by Fred »

So should we always use template on the image when adding it to the SysTray or is there cases where it can be useful to have the original image ?
mrbungle
Enthusiast
Enthusiast
Posts: 143
Joined: Wed Dec 30, 2020 3:18 am

Re: Possible bug with Systray and transparency

Post by mrbungle »

Ideally, it could be a parameter (true or false). I appreciate this is extra work, but you do have these precedents - for example, when Windows supports some enhancement.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Possible bug with Systray and transparency

Post by Fred »

So it should be a flag on LoadImage() and CatchImage() (MacOS only) ?
mrbungle
Enthusiast
Enthusiast
Posts: 143
Joined: Wed Dec 30, 2020 3:18 am

Re: Possible bug with Systray and transparency

Post by mrbungle »

If that approach is easier for you, then I am supportive. Thanks
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Possible bug with Systray and transparency

Post by Fred »

Thanks, moved to feature request to have 'template' like image support in PB.
mrbungle
Enthusiast
Enthusiast
Posts: 143
Joined: Wed Dec 30, 2020 3:18 am

Re: Possible bug with Systray and transparency

Post by mrbungle »

Thank you for the consideration
Post Reply