Fix #112462: Panel buttons remain active after redrawing

This seems to be an issue deep inside UI drawing code. The nodes render
the panel button in the correct place,
but it doesn't correctly update the button state after a redraw, unless
the mouse is moved. The button is still in a `BUTTON_STATE_HIGHLIGHT`
state after drawing, and a mouse press will trigger it regardless of
where the mouse cursor actually is.

A common hack to force a reset of the button state is to add a fake
mouse move event using `WM_event_add_mousemove`.

Pull Request: https://projects.blender.org/blender/blender/pulls/112503
This commit is contained in:
Lukas Tönne 2023-09-21 12:05:08 +02:00
parent 12f51bd1c7
commit fdf1040532

@ -1780,6 +1780,8 @@ static int node_socket_toggle_exec(bContext *C, wmOperator * /*op*/)
ED_node_tree_propagate_change(C, CTX_data_main(C), snode->edittree);
WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr);
/* Hack to force update of the button state after drawing, see #112462. */
WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_FINISHED;
}