Fix #117116: Online manual option not working in context menu #117237

Open
Philipp Oeser wants to merge 1 commits from lichtwerk/blender:117116_c into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

1 Commits

Author SHA1 Message Date
Philipp Oeser f0ed536672 Fix #117116: Online manual option not working in context menu
This was the case when the context menu was spawned from a button in a
menu that was in turn spawned via `WM_OT_call_menu`.
Then, `UI_context_active_but_get` (or
`UI_context_active_but_get_respect_menu` even) are not getting an active
button.
Reason for this is that the current context region (or the region stored
in the popup) is freed from its blocks _somewhere_ along the way when
actually executing the operator. The code around nested menus is a bit
hard to follow, the underlying issue (not having a valid region in
context to work with at all times) should definitely be solved (for
another reason, see NOTE / DOWNSIDE below).

However, there is another way to solve this, and this is calling
`doc_view_manual` directly with its `doc_id` set already (the `doc_id`
is already available when building the context menu, used for the
`Online Python Reference`).

NOTE: the same failure is true for `Copy Python Command` -- and the
"workaround fix" is a bit more work there (it does not have a vairiant
**not** using the context buttons).

DOWNSIDE: we loose the shortcut (F1) shown in the context menu, because
that still needs to point to `doc_view_manual_ui_context`
2024-01-17 16:32:48 +01:00