Fix: Enter on the filebrowser filename label skips operator

Regression from c3dfe1e204.

Above commit put a dummy dragable button over the filename (well, to
allow dragging). Enabling drag ripples down to the button ending up in
the `BUTTON_STATE_HIGHLIGHT` state [which is still good of course].
However, `ui_do_but_EXIT` will then return `WM_UI_HANDLER_BREAK` which
then results in the filebrowser operator being skipped.

`ui_do_but_EXIT` already had a special case for file-browser drag button
[which would return `WM_UI_HANDLER_CONTINUE` instead]. Formerly this was
just the icon, now it is the icon and filename label. So in order to fix
this, remove the explicit check for the `but->imb` which will then
include the dragable label button in the exception for returning
`WM_UI_HANDLER_CONTINUE`.

Fixes #111645.

Pull Request: https://projects.blender.org/blender/blender/pulls/111693
This commit is contained in:
Philipp Oeser
2023-08-30 16:19:38 +02:00
committed by Philipp Oeser
parent b5b77a43e2
commit 4cf0e7acfb

View File

@@ -4900,9 +4900,9 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, con
if (ELEM(event->type, LEFTMOUSE, EVT_PADENTER, EVT_RETKEY) && event->val == KM_PRESS) {
int ret = WM_UI_HANDLER_BREAK;
/* XXX: (a bit ugly) Special case handling for file-browser drag button. */
if (ui_but_drag_is_draggable(but) && but->imb &&
ui_but_contains_point_px_icon(but, data->region, event))
/* XXX: (a bit ugly) Special case handling for file-browser drag buttons (icon and filename
* label). */
if (ui_but_drag_is_draggable(but) && ui_but_contains_point_px_icon(but, data->region, event))
{
ret = WM_UI_HANDLER_CONTINUE;
}