Fix fast clicks on File Browser sort columns not changing sorting

Clicking on the column header is supposed to enable sorting by this
column, or switch the sort order if already enabled.
The double-click event would be blocked by the `file.execute()`
operator, which is not supposed to act if the user clicked outside the
file list.
This commit is contained in:
Julian Eisel 2020-08-07 11:36:37 +02:00
parent 5809dc6b5b
commit 4ba9d7d71e
Notes: blender-bot 2023-02-14 09:03:55 +01:00
Referenced by commit 6c8c30d865, Fix T82002: ENTER does nothing when mouse cursor is over save dialog text field
Referenced by issue #82002, Default button in File Browser does not always listen to the Return / Enter key (regression)
1 changed files with 14 additions and 0 deletions

View File

@ -1697,6 +1697,19 @@ static int file_exec(bContext *C, wmOperator *exec_op)
return OPERATOR_FINISHED;
}
static int file_exec_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
SpaceFile *sfile = CTX_wm_space_file(C);
if (!ED_fileselect_layout_is_inside_pt(
sfile->layout, &region->v2d, event->mval[0], event->mval[1])) {
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;
}
return file_exec(C, op);
}
void FILE_OT_execute(struct wmOperatorType *ot)
{
PropertyRNA *prop;
@ -1707,6 +1720,7 @@ void FILE_OT_execute(struct wmOperatorType *ot)
ot->idname = "FILE_OT_execute";
/* api callbacks */
ot->invoke = file_exec_invoke;
ot->exec = file_exec;
ot->poll = file_operator_poll;