Fix right-click context menus firing their first item on Linux
Bound to <Button-3> with finally: menu.grab_release(), the menu lost its grab immediately and the trailing <ButtonRelease-3> activated the entry under the cursor — right-clicking a history row jumped straight into the edit dialog and deleting was impossible. - RIGHT_CLICK constant: <ButtonRelease-3> (<ButtonRelease-2> on macOS) - history + queue menus built once on self, not per click - drop the premature grab_release() Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,20 @@ Lesson: a tile source that works from `curl` or an `http://` page can still fail
|
||||
from `file://`. Test the map by **opening the generated `karte.html` directly**,
|
||||
not just by checking the URL in the HTML.
|
||||
|
||||
## Tk popup menus: bind `<ButtonRelease-3>`, not `<Button-3>` (2026-09-07)
|
||||
|
||||
`widget.bind("<Button-3>", …)` + `menu.tk_popup(x, y)` + `finally:
|
||||
menu.grab_release()` is the Windows idiom and **misfires on X11**: `tk_popup`
|
||||
returns immediately, `grab_release()` drops the menu's grab, and the pending
|
||||
`<ButtonRelease-3>` then activates whatever entry is under the cursor (the first
|
||||
one). Symptom here: right-click a history row → menu flashes → edit dialog opens.
|
||||
|
||||
Rules for this codebase:
|
||||
- bind the release event: `RIGHT_CLICK` constant (`<ButtonRelease-3>`, or
|
||||
`<ButtonRelease-2>` on macOS),
|
||||
- build each context menu **once** (store on `self`), don't recreate per click,
|
||||
- just call `menu.tk_popup(...)` — no `grab_release()`.
|
||||
|
||||
## Nominatim query order matters
|
||||
|
||||
`geocode_city` returns the **first** hit, trying PLZ-qualified first, then each
|
||||
|
||||
Reference in New Issue
Block a user