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

Added wxTaskBarIcon:new/1 to create popupmenu #2743

Merged
merged 2 commits into from
Oct 28, 2020

Conversation

dominicletz
Copy link
Contributor

With the new cocoa based wxWidgets backend for macos call PopupMenu( menu ) to create a taskicon menu is officially not supported anymore for mac. Thus the only way to create a popup menu is to provide an override for the "wxMenu* CreatePopupMenu()" virtual function.

This patch adds the ability to provide a callback function in the constructor which then servers as CreatePopupMenu() implementation.

I've also supplied a small taskbar sample app, to exemplify the usage.

Selection_307

@IngelaAndin IngelaAndin added the team:PS Assigned to OTP team PS label Sep 8, 2020
@dgud
Copy link
Contributor

dgud commented Sep 15, 2020

Thanks for the PR, I'm in the process of rewriting the code generator for wx (base it of interface files in 3.1) instead of "real" headers, so I will let this wait a while.

@dominicletz
Copy link
Contributor Author

That's great to hear! Would be awesome to have the constants be defined (or at least accessible) through a function, so they become accessible to other beam languages (Elixir in my case)

@dominicletz
Copy link
Contributor Author

Also another thing that I realized is that virtual impl callbacks like this one can create deadlocks when creating new wx objects. Not sure if that is fixable in your effort.

@dgud
Copy link
Contributor

dgud commented Sep 16, 2020

That's great to hear! Would be awesome to have the constants be defined (or at least accessible) through a function, so they become accessible to other beam languages (Elixir in my case)

I'll keep that in mind then, didn't know that you couldn't.

Also another thing that I realized is that virtual impl callbacks like this one can create deadlocks when creating new wx objects. Not sure if that is fixable in your effort.

Can you email me, dgud at erlang org, a short example or an explanation.
The way the callbacks are handled today is to avoid those deadlocks :-(
You can't do calls to other processes from a callback, since the graphics thread is locked waiting for a response
from the callback.

@IngelaAndin IngelaAndin added the stalled waiting for input by the Erlang/OTP team label Sep 29, 2020
@dominicletz
Copy link
Contributor Author

@dgud sorry didn't have time yet to reproduce the menu issue, hopefully will do that later. Regarding your rewrite of the generator, when do you expect that to go into otp? IMHO the current situation is rather buggy since macos is now the only OS you can't use the taskbaricon on. If your rewrite is longer term I would opt to include this as a bugfix until then. Even though the bug is in wx, for people trying to port their apps from windows or linux to macos it's a showstopper right now :-(
I don't even think there is any workaround possible without this patch, if you're aware of one let me know.

Would also be happy to make any changes to the calling interface for injecting the fun if that helps making the current solution more forward compatible.

@dgud
Copy link
Contributor

dgud commented Oct 6, 2020

Ok, will take a better look at this for OTP-23.2 then.

The rewrite targets OTP-24 as it will be backwards incompatible in a couple (many) hopefully not used functions.

@dgud dgud added testing currently being tested, tag is used by OTP internal CI and removed stalled waiting for input by the Erlang/OTP team labels Oct 8, 2020
@dgud
Copy link
Contributor

dgud commented Oct 13, 2020

Can you rebase this on maint, since we want to release this in the next maint release.

Also do we need a new example can it not be added to the existing menu example?

@dominicletz
Copy link
Contributor Author

Sure, can merge the examples and rebase

@dominicletz
Copy link
Contributor Author

here you go @dgud

@dgud dgud removed the testing currently being tested, tag is used by OTP internal CI label Oct 14, 2020
@dgud dgud changed the base branch from master to maint October 14, 2020 06:33
@dgud dgud added the testing currently being tested, tag is used by OTP internal CI label Oct 14, 2020
@dgud dgud merged commit c082b74 into erlang:maint Oct 28, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:PS Assigned to OTP team PS testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants