The tooltip mute reaches as far as the grab, and no further - #208
Merged
Conversation
Review follow-up to 206: the sweep walked every toplevel in the process, on the reasoning that a menu shadows the whole app. That reasoning is right for Collins but it was never spelled out, and it was spelled out nowhere in the code — so scope it explicitly to the popover's window group, which is exactly what its grab covers. gtk_grab_add registers the grab on the group, and gtk_main_do_event looks the current grab up by the group of whatever window an event lands in, then routes the event to the grab widget. Collins puts every window in the default group, so today this mutes the same set as before; a window in a group of its own stays interactive, and now keeps its tooltips. Also says why a menu opening over a menu re-sweeps: the second menu is a fresh subtree to spare, and the first sweep leaves so little armed that the walk is all it costs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FD7QTvXtBfAUDCkLa3eqZe
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.
Follow-up to 206, which merged before its review was addressed. The review
flagged the app-wide sweep in
tooltipmute._mute()as a cross-window bug:opening a menu in one window silences tooltips in another, "fully interactive"
window.
The premise doesn't hold — a menu in one Collins window really does shadow
the next one.
gtk_grab_addregisters the grab on the window group, notthe window, and documents itself as blocking "interaction with other widgets in
the same application".
gtk_main_do_eventthen looks the current grab up bythe group of whatever window the event lands in:
Collins never creates a
GtkWindowGroup, so all its windows sit in the defaultone: with a menu open in window A, a click on a control in window B is routed
to the popover and dismisses the menu instead. A control that can't be clicked
shouldn't be explaining itself, so muting it was right.
What was actually wrong is that none of this was written down, and the code
took the app-wide shortcut rather than saying what it meant. So this scopes
the mute to the popover's window group — the same set today, and the right set
if a window ever gets a group of its own:
_open/_mutedare keyed byGtk.WindowGroupinstead of being process-global._on_querymutes within the queried widget's group only, and a widget withno root is left alone (it can't show a tooltip anyway).
other window's menus.
Also documents the second review note: a menu opening over a menu re-sweeps its
group on purpose (the new menu is a fresh subtree to spare, and the first sweep
leaves so little armed that the walk is all it costs), and a
GtkPopoverMenu'ssubmenus don't come through that path at all — they're pages of one popover.
Verification
Same headless probes as 206, all still passing (context menu mutes all 66
tooltip-bearing widgets and restores all of them; a popover's own tooltips
survive; a widget created mid-menu is muted on first query; a GtkMenuButton's
popover behaves the same), plus a new two-window probe:
GtkWindowGroup, a menu in A leaves B aloneNo screenshots: nothing about the rendered UI changes here.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FD7QTvXtBfAUDCkLa3eqZe