From cb6d018ec9496912943726a0c45829cf8b7c6696 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 14 Dec 2018 08:43:14 +1100 Subject: Fix T57724: Opening file browser flips user-prefs header --- source/blender/editors/screen/area.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 85f46d86abc..3eecab46aa5 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1813,6 +1813,13 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi SpaceLink *sl; /* store sa->type->exit callback */ void *sa_exit = sa->type ? sa->type->exit : NULL; + /* When the user switches between space-types from the type-selector, + * changing the header-type is jarring (especially when using Ctrl-MouseWheel). + * + * However, add-on install for example -forces the header to the top which shouldn't + * be applied back to the previous space type when closing - see: T57724 + */ + const bool sync_header_alignment = (sa->flag & AREA_FLAG_TEMP_TYPE) == 0; int header_alignment = ED_area_header_alignment(sa); /* in some cases (opening temp space) we don't want to @@ -1865,10 +1872,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi /* Sync header alignment. */ - for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { - if (ar->regiontype == RGN_TYPE_HEADER) { - ar->alignment = header_alignment; - break; + if (sync_header_alignment) { + for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) { + if (ar->regiontype == RGN_TYPE_HEADER) { + ar->alignment = header_alignment; + break; + } } } } -- cgit v1.2.3