Cleanup: avoid the term old when storing/restoring context variables

This commit is contained in:
2020-03-04 21:10:48 +11:00
parent fb330dd110
commit a9dc1f6d00
4 changed files with 19 additions and 19 deletions

View File

@@ -8432,10 +8432,10 @@ void ui_but_activate_event(bContext *C, ARegion *ar, uiBut *but)
event.customdata = but;
event.customdatafree = false;
ARegion *old_ar = CTX_wm_region(C);
ARegion *ar_ctx = CTX_wm_region(C);
CTX_wm_region_set(C, ar);
ui_do_button(C, but->block, but, &event);
CTX_wm_region_set(C, old_ar);
CTX_wm_region_set(C, ar_ctx);
}
/**

View File

@@ -687,7 +687,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
ScrArea *sa = NULL;
ARegion *ar;
ARegion *old_ar = scr->active_region;
ARegion *ar_prev = scr->active_region;
ED_screen_areas_iter(win, scr, area_iter)
{
@@ -714,7 +714,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
/* Check for redraw headers. */
if (old_ar != scr->active_region) {
if (ar_prev != scr->active_region) {
ED_screen_areas_iter(win, scr, area_iter)
{
@@ -723,20 +723,20 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
for (ar = area_iter->regionbase.first; ar; ar = ar->next) {
/* Call old area's deactivate if assigned. */
if (ar == old_ar && area_iter->type->deactivate) {
if (ar == ar_prev && area_iter->type->deactivate) {
area_iter->type->deactivate(area_iter);
}
if (ar == old_ar && ar != scr->active_region) {
wmGizmoMap *gzmap = old_ar->gizmo_map;
if (ar == ar_prev && ar != scr->active_region) {
wmGizmoMap *gzmap = ar_prev->gizmo_map;
if (gzmap) {
if (WM_gizmo_highlight_set(gzmap, NULL)) {
ED_region_tag_redraw_no_rebuild(old_ar);
ED_region_tag_redraw_no_rebuild(ar_prev);
}
}
}
if (ar == old_ar || ar == scr->active_region) {
if (ar == ar_prev || ar == scr->active_region) {
do_draw = true;
}
}
@@ -758,9 +758,9 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
}
else {
/* Notifier invokes freeing the buttons... causing a bit too much redraws. */
region_cursor_set_ex(win, sa, scr->active_region, old_ar != scr->active_region);
region_cursor_set_ex(win, sa, scr->active_region, ar_prev != scr->active_region);
if (old_ar != scr->active_region) {
if (ar_prev != scr->active_region) {
/* This used to be a notifier, but needs to be done immediate
* because it can undo setting the right button as active due
* to delayed notifier handling. */

View File

@@ -1722,7 +1722,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
{
ScrArea *sa = CTX_wm_area(C);
SpaceFile *sfile = CTX_wm_space_file(C);
ARegion *ar, *oldar = CTX_wm_region(C);
ARegion *ar, *ar_ctx = CTX_wm_region(C);
const bool is_horizontal = (sfile->layout->flag & FILE_LAYOUT_HOR) != 0;
int i;
@@ -1886,7 +1886,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), const w
ED_region_tag_redraw(ar);
/* and restore context */
CTX_wm_region_set(C, oldar);
CTX_wm_region_set(C, ar_ctx);
return OPERATOR_FINISHED;
}

View File

@@ -3101,9 +3101,9 @@ void wm_event_do_handlers(bContext *C)
if (((is_playing_sound == 1) && (is_playing_screen == 0)) ||
((is_playing_sound == 0) && (is_playing_screen == 1))) {
wmWindow *context_old_win = CTX_wm_window(C);
bScreen *context_screen_win = CTX_wm_screen(C);
Scene *context_scene_win = CTX_data_scene(C);
wmWindow *win_ctx = CTX_wm_window(C);
bScreen *screen_stx = CTX_wm_screen(C);
Scene *scene_ctx = CTX_data_scene(C);
CTX_wm_window_set(C, win);
CTX_wm_screen_set(C, screen);
@@ -3111,9 +3111,9 @@ void wm_event_do_handlers(bContext *C)
ED_screen_animation_play(C, -1, 1);
CTX_data_scene_set(C, context_scene_win);
CTX_wm_screen_set(C, context_screen_win);
CTX_wm_window_set(C, context_old_win);
CTX_data_scene_set(C, scene_ctx);
CTX_wm_screen_set(C, screen_stx);
CTX_wm_window_set(C, win_ctx);
}
if (is_playing_sound == 0) {