Repository navigation
Objects list: open the right-click menu after the button is released - #651
Draft
SmallTardigrade wants to merge 1 commit into
Draft
SmallTardigrade wants to merge 1 commit into
SmallTardigrade wants to merge 1 commit into
Conversation
A row reports a right click on press (ImGui::IsItemClicked), and the menu opens from a posted event while the button is still down. On GTK that menu has no activation time, because a posted event has no current GDK event, so wxWidgets passes GDK_CURRENT_TIME (0). GTK's 500 ms allowance for a quick press and release then never applies, and the release closes the menu. Selection still happens on press. Only the menu waits for the button to come up, which is when the 3D view opens its menu too. Not compiled or run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Right-clicking a part or plate in the Objects list on Linux flashes the menu and closes it straight away. Other right-click menus, including the 3D view's, are fine. This opens the Objects list menu after the button is released instead of while it's held.
This is a draft because the patch has not been compiled or run. The cause below was measured on the released 7.3.1 build. See Tests.
Cause
ImGui::IsItemClicked(ImGuiMouseButton_Right), which is true on the press frame, then postsEVT_OBJ_LIST_COLUMN_SELECT. The menu therefore opens with the button still down.DoPopupMenuuses a temporary one withtime = GDK_CURRENT_TIME(0), and GTK takes the menu's activation time from that.gtk_menu_shell_button_releaseonly ignores a release within 500 ms of the activation time. Measured from 0, that allowance never applies, so the release closes the menu.The 3D view gets the same time of 0, but it posts its event from
RightUp, so no release is left to arrive.Changes
render_plateandhandle_obj_list_select_event) now setm_context_menu_pending.ImGui::IsMouseDown(ImGuiMouseButton_Right)is false.This applies on every platform, so the menu will also open on release on Windows and macOS. ImGui's own
BeginPopupContextItemand the 3D view already work that way.Screenshots/Recordings/Graphs
None. Logged menu opens on 7.3.1 are under Tests.
Tests
Environment: V7.3.1.6378 AppImage, Fedora 44, KDE Wayland, Mesa Intel, GTK 3.24.52. It also happens with
GDK_BACKEND=x11, so it isn't Wayland-specific.Measured on the unpatched 7.3.1 build:
LD_PRELOADlogger aroundgtk_menu_popup_at_rectgave the same two lines in two runs, 3D view first and Objects list second:LD_PRELOADshim ignores a menu's first release if a button is held when it opens. With it, the Objects list menu stays open, and it logged catching that release nine times in one run. That shim is only a workaround and isn't part of this PR.Not tested:
GLCanvas3D::on_mouseit should, since events ImGui handles trigger a render, but this is the first thing to check.🤖 Generated with Claude Code