Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-03-06 18:22:28 +0300
committerJulian Eisel <julian@blender.org>2020-03-06 18:27:13 +0300
commitd5572eacc5958db38ac4a4a32eddb3a2cd24bf68 (patch)
tree5252d8f509dae02bf9c137a1710c073d5bbac592 /source/blender/editors/space_file
parentb242cc67928a6858a835c088e4d3ea8822c83168 (diff)
Cleanup: Reduce context usage in UI functions
Part of https://developer.blender.org/T74429. There's a chance that this causes some issues becaue in some cases we change from getting the window from context to getting it from somewhere else.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r--source/blender/editors/space_file/file_ops.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index ec89ea1be7e..e065c146962 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -536,7 +536,7 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
}
- WM_event_add_mousemove(C); /* for directory changes */
+ WM_event_add_mousemove(CTX_wm_window(C)); /* for directory changes */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
return OPERATOR_FINISHED;
@@ -578,7 +578,8 @@ void FILE_OT_select(wmOperatorType *ot)
/**
* \returns true if selection has changed
*/
-static bool file_walk_select_selection_set(bContext *C,
+static bool file_walk_select_selection_set(wmWindow *win,
+ ARegion *ar,
SpaceFile *sfile,
const int direction,
const int numfiles,
@@ -656,7 +657,7 @@ static bool file_walk_select_selection_set(bContext *C,
/* highlight file under mouse pos */
params->highlight_file = -1;
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
}
/* do the actual selection */
@@ -686,7 +687,7 @@ static bool file_walk_select_selection_set(bContext *C,
fileselect_file_set(sfile, params->active_file);
/* ensure newly selected file is inside viewbounds */
- file_ensure_inside_viewbounds(CTX_wm_region(C), sfile, params->active_file);
+ file_ensure_inside_viewbounds(ar, sfile, params->active_file);
/* selection changed */
return true;
@@ -702,6 +703,8 @@ static bool file_walk_select_do(bContext *C,
const bool extend,
const bool fill)
{
+ wmWindow *win = CTX_wm_window(C);
+ ARegion *ar = CTX_wm_region(C);
struct FileList *files = sfile->files;
const int numfiles = filelist_files_ensure(files);
const bool has_selection = file_is_any_selected(files);
@@ -717,7 +720,6 @@ static bool file_walk_select_do(bContext *C,
}
if (has_selection) {
- ARegion *ar = CTX_wm_region(C);
FileLayout *layout = ED_fileselect_get_layout(sfile, ar);
const int idx_shift = (layout->flag & FILE_LAYOUT_HOR) ? layout->rows : layout->flow_columns;
@@ -763,7 +765,8 @@ static bool file_walk_select_do(bContext *C,
}
}
- return file_walk_select_selection_set(C,
+ return file_walk_select_selection_set(win,
+ ar,
sfile,
direction,
numfiles,
@@ -867,7 +870,7 @@ static int file_select_all_exec(bContext *C, wmOperator *op)
}
file_draw_check(C);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
ED_area_tag_redraw(sa);
return OPERATOR_FINISHED;