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:
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r--source/blender/editors/screen/area.c47
1 files changed, 36 insertions, 11 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 41c3a2ca285..ccee88eb0d6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1947,7 +1947,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
if (sa->spacetype != type) {
SpaceType *st;
- SpaceLink *slold;
+ SpaceLink *slold = sa->spacedata.first;
SpaceLink *sl;
/* store sa->type->exit callback */
void *sa_exit = sa->type ? sa->type->exit : NULL;
@@ -1963,7 +1963,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
*/
int header_alignment = ED_area_header_alignment_or_fallback(sa, -1);
const bool sync_header_alignment = ((header_alignment != -1) &&
- (sa->flag & AREA_FLAG_TEMP_TYPE) == 0);
+ ((slold->link_flag & SPACE_FLAG_TYPE_TEMPORARY) == 0));
/* in some cases (opening temp space) we don't want to
* call area exit callback, so we temporarily unset it */
@@ -1979,7 +1979,6 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
}
st = BKE_spacetype_from_id(type);
- slold = sa->spacedata.first;
sa->spacetype = type;
sa->type = st;
@@ -2010,6 +2009,10 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
slold->regionbase = sa->regionbase;
sa->regionbase = sl->regionbase;
BLI_listbase_clear(&sl->regionbase);
+ /* SPACE_FLAG_TYPE_WAS_ACTIVE is only used to go back to a previously active space that is
+ * overlapped by temporary ones. It's now properly activated, so the flag should be cleared
+ * at this point. */
+ sl->link_flag &= ~SPACE_FLAG_TYPE_WAS_ACTIVE;
/* put in front of list */
BLI_remlink(&sa->spacedata, sl);
@@ -2073,23 +2076,45 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi
ED_area_tag_redraw(sa);
}
-void ED_area_prevspace(bContext *C, ScrArea *sa)
+static SpaceLink *area_get_prevspace(ScrArea *sa)
{
SpaceLink *sl = sa->spacedata.first;
- if (sl && sl->next) {
- ED_area_newspace(C, sa, sl->next->spacetype, false);
+ /* First toggle to the next temporary space in the list. */
+ for (SpaceLink *sl_iter = sl->next; sl_iter; sl_iter = sl_iter->next) {
+ if (sl_iter->link_flag & SPACE_FLAG_TYPE_TEMPORARY) {
+ return sl_iter;
+ }
+ }
+
+ /* No temporary space, find the item marked as last active. */
+ for (SpaceLink *sl_iter = sl->next; sl_iter; sl_iter = sl_iter->next) {
+ if (sl_iter->link_flag & SPACE_FLAG_TYPE_WAS_ACTIVE) {
+ return sl_iter;
+ }
+ }
+
+ /* If neither is found, we can just return to the regular previous one. */
+ return sl->next;
+}
+
+void ED_area_prevspace(bContext *C, ScrArea *sa)
+{
+ SpaceLink *sl = sa->spacedata.first;
+ SpaceLink *prevspace = sl ? area_get_prevspace(sa) : NULL;
- /* 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);
+ if (prevspace) {
+ ED_area_newspace(C, sa, prevspace->spacetype, false);
+ /* We've exited the space, so it can't be considered temporary anymore. */
+ sl->link_flag &= ~SPACE_FLAG_TYPE_TEMPORARY;
}
else {
/* no change */
return;
}
- sa->flag &= ~(AREA_FLAG_STACKED_FULLSCREEN | AREA_FLAG_TEMP_TYPE);
+ /* If this is a stacked fullscreen, changing to previous area exits it (meaning we're still in a
+ * fullscreen, but not in a stacked one). */
+ sa->flag &= ~AREA_FLAG_STACKED_FULLSCREEN;
ED_area_tag_redraw(sa);