.mouseLeaveAction in combo with Menu(MenuAction()).front in .action freezes interpreter?

hi. using .mouseLeaveAction in combination with Menu(MenuAction()).front in .action freezes the interpreter. what’s likely a reason, and how can I use both .mouseLeaveAction and .action with Menu / MenuAction?

(
var rect = Rect(0, 0, 100, 100);
var window = Window.new(bounds: rect);
var button = Button.new(window, rect).string_("Click!");

button.mouseOverAction = {}; // its ok
button.mouseLeaveAction = {}; // freeze occurs after adding .mouseLeaveAction
button.action = { Menu(MenuAction("Test")).front }; 
window.front
)

hello, i have a suspicion, but it is only that :wink: This code runs fine on Xorg, but i suspect you are running Wayland. There are some issues with popping up windows/panes in front with Wayland.

hi. thanks for the hint! but I have no idea what that means. a quick search shows that you mentioned two different display server protocols for linux. I’m using macos and everything that comes with it. also, can anyone with macos confirm whether this code works or not on your machine?

i can confirm the crash.
You can work around it with button.menu. But then button.action is never evaluated. in the code below “clicked” never get-s posted.

(
var rect = Rect(0, 0, 100, 100);
var window = Window.new(bounds: rect).acceptsMouseOver_(true);
var button = Button.new(window, rect).string_("Click!");

button.mouseOverAction = { \woof.postln }; 
button.mouseLeaveAction = { \meow.postln }; 
button.menu = Menu(
	MenuAction("Test", { \tested.postln }), 
	MenuAction("me", { \you.postln }), 
	MenuAction("please", { \thankyou.postln }));
button.action = { \clicked.postln };
window.front
)
1 Like