diff options
author | Julian Eisel <julian@blender.org> | 2020-08-07 12:36:37 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-08-07 12:39:04 +0300 |
commit | 4ba9d7d71e8fc00d04f0c830cf8cabe486d22321 (patch) | |
tree | 0c4000da94214ea9e7c97e89a6ca34df66467ff6 /source/blender/editors/space_file/file_ops.c | |
parent | 5809dc6b5b60351867260f4dbe906a9969619264 (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 6ce81f90de0..e9ffd4583d7 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -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, ®ion->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; |