godot icon indicating copy to clipboard operation
godot copied to clipboard

PopupMenu breaks future mouse interactions

Open rosshadden opened this issue 2 years ago • 3 comments

Godot version

4.0.dev (7e79aead99)

System information

Arch Linux, GLES3, AMD RX 7900 XTX

Issue description

After calling popup() on a PopupMenu inside a GraphEdit, some future mouse interactivity breaks. By this I mean you can no longer click the editor's scroll bars, or any buttons (neither pre-existing nor custom). I have not yet figured out a way to fix it other than closing the graph editor and re-opening it again (which is not possible in this included MVP, but might be useful troubleshooting knowledge).

This issues is not present if the display/window/subwindows/embed_subwindows option is enabled. I'm not sure whether being inside a graph matters.

Steps to reproduce

  1. Run game.
  2. Click built-in GraphEdit buttons to verify that they work as expected (toggle grid, etc.).
  3. Try dragging the GraphEdit scrollbars to verify that they work as expected.
  4. Click my custom "some button" I added to verify that it prints "button pressed".
  5. Right click anywhere, which calls PopupMenu#popup, and then close the popup however you wish (clicking outside, escape, etc.).
  6. Repeat steps 1-3 and see that they no longer work as expected.

Minimal reproduction project

mvp.zip

rosshadden avatar Feb 21 '23 20:02 rosshadden

Can you please test, if accepting the event in your MRP solves your problem?

func _input(event: InputEvent) -> void:
	if not event is InputEventMouseButton: return

	var e := event as InputEventMouseButton
	match e.button_index:
		MOUSE_BUTTON_RIGHT:
			if e.is_pressed():
				menu.position = position + get_global_mouse_position()
				menu.popup()
				accept_event() # This line is new.

Sauermann avatar Feb 21 '23 21:02 Sauermann

Yes! That does solve it. So is this a user error thing, is what happens intentional? Thank you very much for the quick reply.

rosshadden avatar Feb 21 '23 22:02 rosshadden

I have the same issue but instead in an editor plugin. The proposed solution does not work for me in this case. Once the menu pops nothing at all in the editor can be clicked until the right-mouse button has been pressed; this includes all other panels and even the code editor.

nulflux avatar Apr 25 '24 18:04 nulflux