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
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')
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c2
-rw-r--r--source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c2
-rw-r--r--source/blender/editors/include/ED_image.h4
-rw-r--r--source/blender/editors/include/UI_interface.h2
-rw-r--r--source/blender/editors/interface/interface_eyedropper_datablock.c6
-rw-r--r--source/blender/editors/interface/interface_handlers.c26
-rw-r--r--source/blender/editors/interface/interface_ops.c2
-rw-r--r--source/blender/editors/interface/interface_region_menu_pie.c2
-rw-r--r--source/blender/editors/interface/interface_region_menu_popup.c18
-rw-r--r--source/blender/editors/interface/interface_region_popover.c4
-rw-r--r--source/blender/editors/interface/interface_region_popup.c9
-rw-r--r--source/blender/editors/interface/view2d_ops.c7
-rw-r--r--source/blender/editors/mesh/editmesh_polybuild.c10
-rw-r--r--source/blender/editors/screen/area.c9
-rw-r--r--source/blender/editors/screen/screen_edit.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/screen/workspace_edit.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c17
-rw-r--r--source/blender/editors/space_image/image_ops.c14
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
-rw-r--r--source/blender/editors/undo/ed_undo.c6
22 files changed, 72 insertions, 78 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index a2b654dfa68..99ac683747f 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -354,7 +354,7 @@ static int gizmo_arrow_modal(bContext *C,
/* tag the region for redraw */
ED_region_tag_redraw_editor_overlays(ar);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
index 5ff76d886c2..6f6f131136c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c
@@ -1087,7 +1087,7 @@ static int gizmo_cage2d_modal(bContext *C,
/* tag the region for redraw */
ED_region_tag_redraw_editor_overlays(CTX_wm_region(C));
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
index 393568e8382..6f424252b91 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c
@@ -586,7 +586,7 @@ static int gizmo_cage3d_modal(bContext *C,
/* tag the region for redraw */
ED_region_tag_redraw_editor_overlays(CTX_wm_region(C));
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_RUNNING_MODAL;
}
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index e97630cfb99..6cf633b477c 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -122,8 +122,8 @@ void ED_image_draw_info(struct Scene *scene,
bool ED_space_image_show_cache(struct SpaceImage *sima);
-bool ED_image_should_save_modified(const struct bContext *C);
-int ED_image_save_all_modified_info(const struct bContext *C, struct ReportList *reports);
+bool ED_image_should_save_modified(const struct Main *bmain);
+int ED_image_save_all_modified_info(const struct Main *bmain, struct ReportList *reports);
bool ED_image_save_all_modified(const struct bContext *C, struct ReportList *reports);
/* image_sequence.c */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 554a166b2ce..e83582b19d0 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -632,7 +632,7 @@ void uiPupBlockOperator(struct bContext *C,
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block);
-bool UI_popup_block_name_exists(struct bContext *C, const char *name);
+bool UI_popup_block_name_exists(const struct bScreen *screen, const char *name);
/* Blocks
*
diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c
index fd5a46e7716..0220f3f5afd 100644
--- a/source/blender/editors/interface/interface_eyedropper_datablock.c
+++ b/source/blender/editors/interface/interface_eyedropper_datablock.c
@@ -125,7 +125,9 @@ static int datadropper_init(bContext *C, wmOperator *op)
static void datadropper_exit(bContext *C, wmOperator *op)
{
- WM_cursor_modal_restore(CTX_wm_window(C));
+ wmWindow *win = CTX_wm_window(C);
+
+ WM_cursor_modal_restore(win);
if (op->customdata) {
DataDropper *ddr = (DataDropper *)op->customdata;
@@ -139,7 +141,7 @@ static void datadropper_exit(bContext *C, wmOperator *op)
op->customdata = NULL;
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
}
/* *** datadropper id helper functions *** */
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index e96e4bfd72a..cf736d65596 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -1552,7 +1552,7 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void
false);
ui_handler_region_drag_toggle_remove(C, drag_info);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
return WM_UI_HANDLER_BREAK;
}
else {
@@ -1843,7 +1843,7 @@ static bool ui_but_drag_init(bContext *C,
const wmEvent *event)
{
/* prevent other WM gestures to start while we try to drag */
- WM_gestures_remove(C);
+ WM_gestures_remove(CTX_wm_window(C));
/* Clamp the maximum to half the UI unit size so a high user preference
* doesn't require the user to drag more then half the default button height. */
@@ -3280,7 +3280,7 @@ wmIMEData *ui_but_ime_data_get(uiBut *but)
static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = data->window;
int len;
const bool is_num_but = ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER);
bool no_zero_strip = false;
@@ -3370,7 +3370,7 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
- wmWindow *win = CTX_wm_window(C);
+ wmWindow *win = data->window;
if (but) {
if (UI_but_is_utf8(but)) {
@@ -3945,7 +3945,7 @@ static void ui_but_extra_operator_icon_apply(bContext *C, uiBut *but, uiButExtra
/* Force recreation of extra operator icons (pseudo update). */
ui_but_extra_operator_icons_free(but);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
/** \} */
@@ -4020,8 +4020,7 @@ static void ui_block_open_begin(bContext *C, uiBut *but, uiHandleButtonData *dat
#ifdef USE_ALLSELECT
{
- wmWindow *win = CTX_wm_window(C);
- if (IS_ALLSELECT_EVENT(win->eventstate)) {
+ if (IS_ALLSELECT_EVENT(data->window->eventstate)) {
data->select_others.is_enabled = true;
}
}
@@ -5570,7 +5569,7 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, co
* The active state of the button could be maintained some other way
* and remove this mousemove event.
*/
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(data->window);
return WM_UI_HANDLER_BREAK;
}
@@ -8039,11 +8038,12 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
static void button_activate_exit(
bContext *C, uiBut *but, uiHandleButtonData *data, const bool mousemove, const bool onfree)
{
+ wmWindow *win = data->window;
uiBlock *block = but->block;
uiBut *bt;
if (but->type == UI_BTYPE_GRIP) {
- WM_cursor_modal_restore(data->window);
+ WM_cursor_modal_restore(win);
}
/* ensure we are in the exit state */
@@ -8160,7 +8160,7 @@ static void button_activate_exit(
* still over a button. We cannot just check for this ourselves because
* at this point the mouse may be over a button in another region */
if (mousemove) {
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
}
@@ -8818,7 +8818,7 @@ static int ui_handle_button_event(bContext *C, const wmEvent *event, uiBut *but)
button_activate_init(C, ar, post_but, post_type);
}
else {
- /* XXX issue is because WM_event_add_mousemove(C) is a bad hack and not reliable,
+ /* XXX issue is because WM_event_add_mousemove(wm) is a bad hack and not reliable,
* if that gets coded better this bypass can go away too.
*
* This is needed to make sure if a button was active,
@@ -9592,7 +9592,7 @@ static int ui_handle_menu_event(bContext *C,
but->active->cancel = true;
button_activate_exit(C, but, but->active, false, false);
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(but->active->window);
}
}
break;
@@ -10776,7 +10776,7 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata)
temp.cancel_func(C, temp.popup_arg);
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
}
else {
/* re-enable tooltips */
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 9fa8431beea..9de2824e3a3 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -1649,7 +1649,7 @@ static int ui_button_press_invoke(bContext *C, wmOperator *op, const wmEvent *ev
but->optype = but_optype;
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c
index 330a9d48ff4..f75f4c054a3 100644
--- a/source/blender/editors/interface/interface_region_menu_pie.c
+++ b/source/blender/editors/interface/interface_region_menu_pie.c
@@ -213,7 +213,7 @@ void UI_pie_menu_end(bContext *C, uiPieMenu *pie)
menu->towardstime = PIL_check_seconds_timer();
UI_popup_handlers_add(C, &window->modalhandlers, menu, WM_HANDLER_ACCEPT_DBL_CLICK);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
MEM_freeN(pie);
}
diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c
index 560c6146afe..2b6125fc193 100644
--- a/source/blender/editors/interface/interface_region_menu_popup.c
+++ b/source/blender/editors/interface/interface_region_menu_popup.c
@@ -357,7 +357,7 @@ uiPopupBlockHandle *ui_popup_menu_create(
handle->popup = true;
UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
}
MEM_freeN(pup);
@@ -467,7 +467,7 @@ void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
menu->popup = true;
UI_popup_handlers_add(C, &window->modalhandlers, menu, 0);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
MEM_freeN(pup);
}
@@ -599,7 +599,7 @@ void UI_popup_block_invoke_ex(bContext *C,
UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
UI_block_active_only_flagged_buttons(C, handle->region, handle->region->uiblocks.first);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
}
void UI_popup_block_invoke(bContext *C,
@@ -633,7 +633,7 @@ void UI_popup_block_ex(bContext *C,
UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
UI_block_active_only_flagged_buttons(C, handle->region, handle->region->uiblocks.first);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
}
#if 0 /* UNUSED */
@@ -676,14 +676,10 @@ void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
}
}
-bool UI_popup_block_name_exists(bContext *C, const char *name)
+bool UI_popup_block_name_exists(const bScreen *screen, const char *name)
{
- bScreen *sc = CTX_wm_screen(C);
- uiBlock *block;
- ARegion *ar;
-
- for (ar = sc->regionbase.first; ar; ar = ar->next) {
- for (block = ar->uiblocks.first; block; block = block->next) {
+ for (const ARegion *ar = screen->regionbase.first; ar; ar = ar->next) {
+ for (const uiBlock *block = ar->uiblocks.first; block; block = block->next) {
if (STREQ(block->name, name)) {
return true;
}
diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c
index f412519d655..5e88d48a787 100644
--- a/source/blender/editors/interface/interface_region_popover.c
+++ b/source/blender/editors/interface/interface_region_popover.c
@@ -284,7 +284,7 @@ uiPopupBlockHandle *ui_popover_panel_create(
* add a modal handler and pass on events. */
if (!but) {
UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
handle->popup = true;
}
@@ -403,7 +403,7 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
/* Add handlers. */
UI_popup_handlers_add(C, &window->modalhandlers, handle, 0);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(window);
handle->popup = true;
/* Re-add so it gets priority. */
diff --git a/source/blender/editors/interface/interface_region_popup.c b/source/blender/editors/interface/interface_region_popup.c
index 462f4871764..b509f5e352b 100644
--- a/source/blender/editors/interface/interface_region_popup.c
+++ b/source/blender/editors/interface/interface_region_popup.c
@@ -706,15 +706,6 @@ uiBlock *ui_popup_block_refresh(bContext *C,
}
}
else {
- /* Add an offset to draw the popover arrow. */
- if ((block->flag & UI_BLOCK_POPOVER) && ELEM(block->direction, UI_DIR_UP, UI_DIR_DOWN)) {
- /* Keep sync with 'ui_draw_popover_back_impl'. */
- const float unit_size = U.widget_unit / block->aspect;
- const float unit_half = unit_size * (block->direction == UI_DIR_DOWN ? 0.5 : -0.5);
-
- UI_block_translate(block, 0, -unit_half);
- }
-
/* clip block with window boundary */
ui_popup_block_clip(window, block);
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 527c23e4588..10d327cb2ba 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -188,7 +188,7 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float
ED_region_tag_redraw_no_rebuild(vpd->ar);
/* request updates to be done... */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY);
}
@@ -1592,6 +1592,7 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, const rctf *cur, const int
/* only meant for timer usage */
static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
+ wmWindow *win = CTX_wm_window(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
struct SmoothView2DStore *sms = v2d->sms;
@@ -1616,11 +1617,11 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
MEM_freeN(v2d->sms);
v2d->sms = NULL;
- WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), v2d->smooth_timer);
+ WM_event_remove_timer(CTX_wm_manager(C), win, v2d->smooth_timer);
v2d->smooth_timer = NULL;
/* Event handling won't know if a UI item has been moved under the pointer. */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
}
else {
/* ease in/out */
diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c
index 08d513e43ac..c9438f43e04 100644
--- a/source/blender/editors/mesh/editmesh_polybuild.c
+++ b/source/blender/editors/mesh/editmesh_polybuild.c
@@ -162,7 +162,7 @@ static int edbm_polybuild_transform_at_cursor_invoke(bContext *C,
}
}
BM_select_history_store(bm, ele_act);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
@@ -244,7 +244,7 @@ static int edbm_polybuild_delete_at_cursor_invoke(bContext *C,
ED_object_base_activate(C, basact);
}
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
else {
@@ -411,7 +411,7 @@ static int edbm_polybuild_face_at_cursor_invoke(bContext *C, wmOperator *op, con
}
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
@@ -495,7 +495,7 @@ static int edbm_polybuild_split_at_cursor_invoke(bContext *C,
EDBM_mesh_normals_update(em);
EDBM_update_generic(vc.obedit->data, true, true);
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(vc.win);
if (vc.view_layer->basact != basact) {
ED_object_base_activate(C, basact);
@@ -592,7 +592,7 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C,
ED_object_base_activate(C, basact);
}
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(vc.win);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 26240482e6d..c6e7b9d382a 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1971,6 +1971,7 @@ void ED_area_data_swap(ScrArea *sa_dst, ScrArea *sa_src)
void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
{
ScrArea *tmp = MEM_callocN(sizeof(ScrArea), "addscrarea");
+ wmWindow *win = CTX_wm_window(C);
ED_area_exit(C, sa1);
ED_area_exit(C, sa2);
@@ -1978,14 +1979,14 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
ED_area_data_copy(tmp, sa1, false);
ED_area_data_copy(sa1, sa2, true);
ED_area_data_copy(sa2, tmp, true);
- ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa1);
- ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa2);
+ ED_area_initialize(CTX_wm_manager(C), win, sa1);
+ ED_area_initialize(CTX_wm_manager(C), win, sa2);
BKE_screen_area_free(tmp);
MEM_freeN(tmp);
/* tell WM to refresh, cursor types etc */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
ED_area_tag_redraw(sa1);
ED_area_tag_refresh(sa1);
@@ -2119,7 +2120,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
ED_area_initialize(CTX_wm_manager(C), win, sa);
/* tell WM to refresh, cursor types etc */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
/* send space change notifier */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CHANGED, sa);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index c94c6ca9acb..6c86b05e1c7 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -1013,7 +1013,7 @@ void screen_change_update(bContext *C, wmWindow *win, bScreen *sc)
WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTSET, layout);
/* makes button hilites work */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(win);
}
/**
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 35d84d5d75e..26529e4afcb 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -4042,7 +4042,7 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
}
ED_area_tag_redraw(CTX_wm_area(C));
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c
index 7f3131a705e..e61b42bf99f 100644
--- a/source/blender/editors/screen/workspace_edit.c
+++ b/source/blender/editors/screen/workspace_edit.c
@@ -334,7 +334,7 @@ static int workspace_append_activate_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", filepath);
WorkSpace *appended_workspace = (WorkSpace *)WM_file_append_datablock(
- C, filepath, ID_WS, idname);
+ bmain, CTX_data_scene(C), CTX_data_view_layer(C), CTX_wm_view3d(C), filepath, ID_WS, idname);
if (appended_workspace) {
/* Set defaults. */
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;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 3126c695a3a..86cb27465c7 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2315,12 +2315,12 @@ static bool image_has_valid_path(Image *ima)
return strchr(ima->name, '\\') || strchr(ima->name, '/');
}
-bool ED_image_should_save_modified(const bContext *C)
+bool ED_image_should_save_modified(const Main *bmain)
{
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- uint modified_images_count = ED_image_save_all_modified_info(C, &reports);
+ uint modified_images_count = ED_image_save_all_modified_info(bmain, &reports);
bool should_save = modified_images_count || !BLI_listbase_is_empty(&reports.list);
BKE_reports_clear(&reports);
@@ -2328,9 +2328,8 @@ bool ED_image_should_save_modified(const bContext *C)
return should_save;
}
-int ED_image_save_all_modified_info(const bContext *C, ReportList *reports)
+int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports)
{
- Main *bmain = CTX_data_main(C);
GSet *unique_paths = BLI_gset_str_new(__func__);
int num_saveable_images = 0;
@@ -2387,9 +2386,10 @@ int ED_image_save_all_modified_info(const bContext *C, ReportList *reports)
bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
{
- ED_image_save_all_modified_info(C, reports);
-
Main *bmain = CTX_data_main(C);
+
+ ED_image_save_all_modified_info(bmain, reports);
+
bool ok = true;
for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
@@ -2417,7 +2417,7 @@ bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
static bool image_save_all_modified_poll(bContext *C)
{
- int num_files = ED_image_save_all_modified_info(C, NULL);
+ int num_files = ED_image_save_all_modified_info(CTX_data_main(C), NULL);
return num_files > 0;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 8b4012d6547..4658198e4e1 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -381,7 +381,7 @@ static void view3d_smoothview_apply(bContext *C, View3D *v3d, ARegion *ar, bool
}
/* Event handling won't know if a UI item has been moved under the pointer. */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
if (sync_boxview && (rv3d->viewlock & RV3D_BOXVIEW)) {
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c
index 9a9f5885021..5b5d1338637 100644
--- a/source/blender/editors/undo/ed_undo.c
+++ b/source/blender/editors/undo/ed_undo.c
@@ -389,7 +389,7 @@ static int ed_undo_exec(bContext *C, wmOperator *op)
int ret = ed_undo_step_direction(C, 1, op->reports);
if (ret & OPERATOR_FINISHED) {
/* Keep button under the cursor active. */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
ED_outliner_select_sync_from_all_tag(C);
@@ -418,7 +418,7 @@ static int ed_redo_exec(bContext *C, wmOperator *op)
int ret = ed_undo_step_direction(C, -1, op->reports);
if (ret & OPERATOR_FINISHED) {
/* Keep button under the cursor active. */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
ED_outliner_select_sync_from_all_tag(C);
@@ -432,7 +432,7 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op))
ret = ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
if (ret & OPERATOR_FINISHED) {
/* Keep button under the cursor active. */
- WM_event_add_mousemove(C);
+ WM_event_add_mousemove(CTX_wm_window(C));
}
return ret;
}