diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2016-02-29 18:18:42 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2016-02-29 18:18:42 +0300 |
commit | e61588c5a5446fe8b0d7c974c7619268d5900031 (patch) | |
tree | 7a3c2ee00f26de4780313356c4d8a485bcb1833c /source/blender/editors/screen | |
parent | 49ba9740b8ed55eca742a43b36a47d6b55cb207d (diff) |
Fix a bunch of temp full-screen glitches
Steps to reproduce fixed glitches were:
* Change any editor to be file browser from menu, Ctrl+O *from the file browser area*, Esc -> area reset to what it was before changing to file browser initially
* Ctrl+O from any area, F12, Esc -> returns to initial editor in full-screen (expected is file browser in full-screen)
Fixes T46229
Core of the fix is removing old area from spacedata list when going back to previous area (see ED_area_prevspace -> BKE_spacedata_remove). Also, when creating a new temp area we now don't exit old area anymore (needed so SpaceFile->op is kept, but it also makes sense in general)
Aaand finally removes some ugly hacks.
Tested quite a bit, so I think it's safe to apply (besides of remark below), just would like to get things double checked and confirmed. After all, this full-screen stuff finally starts to feel like it's working :P
Note, there's still a memory leak when quitting Blender with temp area open. Haven't found out how to solve yet, but it's not that important for review anyway.
Reviewers: campbellbarton, brecht
Reviewed By: brecht
Subscribers: plyczkowski, Blendify
Maniphest Tasks: T46229
Differential Revision: https://developer.blender.org/D1531
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 30 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_edit.c | 14 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 2 |
3 files changed, 29 insertions, 17 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 3d116d6d6a0..37847b0e640 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1611,15 +1611,31 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2) ED_area_tag_refresh(sa2); } -void ED_area_newspace(bContext *C, ScrArea *sa, int type) +/** + * \param skip_ar_exit Skip calling area exit callback. Set for opening temp spaces. + */ +void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exit) { if (sa->spacetype != type) { SpaceType *st; SpaceLink *slold; SpaceLink *sl; + /* store sa->type->exit callback */ + void *sa_exit = sa->type ? sa->type->exit : NULL; + + /* in some cases (opening temp space) we don't want to + * call area exit callback, so we temporarily unset it */ + if (skip_ar_exit && sa->type) { + sa->type->exit = NULL; + } ED_area_exit(C, sa); + /* restore old area exit callback */ + if (skip_ar_exit && sa->type) { + sa->type->exit = sa_exit; + } + st = BKE_spacetype_from_id(type); slold = sa->spacedata.first; @@ -1686,12 +1702,12 @@ void ED_area_prevspace(bContext *C, ScrArea *sa) SpaceLink *sl = sa->spacedata.first; if (sl && sl->next) { - /* workaround for case of double prevspace, render window - * with a file browser on top of it */ - if (sl->next->spacetype == SPACE_FILE && sl->next->next) - ED_area_newspace(C, sa, sl->next->next->spacetype); - else - ED_area_newspace(C, sa, sl->next->spacetype); + ED_area_newspace(C, sa, sl->next->spacetype, false); + + /* keep old spacedata but move it to end, so calling + * ED_area_prevspace once more won't open it again */ + BLI_remlink(&sa->spacedata, sl); + BLI_addtail(&sa->spacedata, sl); } else { /* no change */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index fce2ef3eb2d..cb07ce756a6 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -1800,25 +1800,21 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type) newsa->flag &= ~AREA_FLAG_TEMP_TYPE; } - ED_area_newspace(C, newsa, type); - + ED_area_newspace(C, newsa, type, (newsa->flag & AREA_FLAG_TEMP_TYPE)); + return newsa; } /** * \a was_prev_temp for the case previous space was a temporary fullscreen as well */ -void ED_screen_full_prevspace(bContext *C, ScrArea *sa, const bool was_prev_temp) +void ED_screen_full_prevspace(bContext *C, ScrArea *sa) { BLI_assert(sa->full); if (sa->flag & AREA_FLAG_STACKED_FULLSCREEN) { /* stacked fullscreen -> only go back to previous screen and don't toggle out of fullscreen */ ED_area_prevspace(C, sa); - /* only clear if previous space wasn't a temp fullscreen as well */ - if (!was_prev_temp) { - sa->flag &= ~AREA_FLAG_TEMP_TYPE; - } } else { ED_screen_restore_temp_type(C, sa); @@ -1853,7 +1849,7 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa) if (sl->next) { if (sa->flag & AREA_FLAG_TEMP_TYPE) { - ED_screen_full_prevspace(C, sa, false); + ED_screen_full_prevspace(C, sa); } else { ED_screen_state_toggle(C, win, sa, state); @@ -1963,7 +1959,7 @@ ScrArea *ED_screen_state_toggle(bContext *C, wmWindow *win, ScrArea *sa, const s if (state == SCREENMAXIMIZED) { /* returns the top small area */ newa = area_split(sc, (ScrArea *)sc->areabase.first, 'h', 0.99f, 1); - ED_area_newspace(C, newa, SPACE_INFO); + ED_area_newspace(C, newa, SPACE_INFO, false); /* copy area */ newa = newa->prev; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 7806038b313..d485a163bd8 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -3838,7 +3838,7 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - ED_screen_full_prevspace(C, sa, false); + ED_screen_full_prevspace(C, sa); return OPERATOR_FINISHED; } |