Fix T42754: File-Selector lost on fullscreen exit
There was a hard-coded check to exit the fileselector when restoring a view. Now, when space types differ, flag areas as temporary and switch back to the previous type only in this case. This means you can select a file while having a file-selector space type open, and not loose it every time.
This commit is contained in:
@@ -107,6 +107,7 @@ void ED_screen_set_subwinactive(struct bContext *C, struct wmEvent *event);
|
||||
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
|
||||
void ED_screen_animation_timer(struct bContext *C, int redraws, int refresh, int sync, int enable);
|
||||
void ED_screen_animation_timer_update(struct bScreen *screen, int redraws, int refresh);
|
||||
void ED_screen_retore_temp_type(struct bContext *C, ScrArea *sa, bool is_screen_change);
|
||||
ScrArea *ED_screen_full_newspace(struct bContext *C, ScrArea *sa, int type);
|
||||
void ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
|
||||
void ED_screen_full_restore(struct bContext *C, ScrArea *sa);
|
||||
|
||||
@@ -1748,6 +1748,13 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
|
||||
}
|
||||
}
|
||||
|
||||
if (sa && (sa->spacetype != type)) {
|
||||
newsa->flag |= AREA_FLAG_TEMP_TYPE;
|
||||
}
|
||||
else {
|
||||
newsa->flag &= ~AREA_FLAG_TEMP_TYPE;
|
||||
}
|
||||
|
||||
ED_area_newspace(C, newsa, type);
|
||||
|
||||
return newsa;
|
||||
@@ -1763,6 +1770,21 @@ void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
|
||||
ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED);
|
||||
}
|
||||
|
||||
void ED_screen_retore_temp_type(bContext *C, ScrArea *sa, bool is_screen_change)
|
||||
{
|
||||
/* incase nether functions below run */
|
||||
ED_area_tag_redraw(sa);
|
||||
|
||||
if (sa->flag & AREA_FLAG_TEMP_TYPE) {
|
||||
ED_area_prevspace(C, sa);
|
||||
sa->flag &= ~AREA_FLAG_TEMP_TYPE;
|
||||
}
|
||||
|
||||
if (is_screen_change && sa->full) {
|
||||
ED_screen_state_toggle(C, CTX_wm_window(C), sa, SCREENMAXIMIZED);
|
||||
}
|
||||
}
|
||||
|
||||
/* restore a screen / area back to default operation, after temp fullscreen modes */
|
||||
void ED_screen_full_restore(bContext *C, ScrArea *sa)
|
||||
{
|
||||
@@ -1789,12 +1811,14 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa)
|
||||
else
|
||||
ED_screen_state_toggle(C, win, sa, state);
|
||||
}
|
||||
else if (sl->spacetype == SPACE_FILE) {
|
||||
else if (sa->flag & AREA_FLAG_TEMP_TYPE) {
|
||||
ED_screen_full_prevspace(C, sa);
|
||||
}
|
||||
else {
|
||||
ED_screen_state_toggle(C, win, sa, state);
|
||||
}
|
||||
|
||||
sa->flag &= ~AREA_FLAG_TEMP_TYPE;
|
||||
}
|
||||
/* otherwise just tile the area again */
|
||||
else {
|
||||
|
||||
@@ -272,12 +272,16 @@ typedef struct ARegion {
|
||||
// #define WIN_EQUAL 3 // UNUSED
|
||||
|
||||
/* area->flag */
|
||||
#define HEADER_NO_PULLDOWN (1 << 0)
|
||||
#define AREA_FLAG_DRAWJOINTO (1 << 1)
|
||||
#define AREA_FLAG_DRAWJOINFROM (1 << 2)
|
||||
#define AREA_TEMP_INFO (1 << 3)
|
||||
#define AREA_FLAG_DRAWSPLIT_H (1 << 4)
|
||||
#define AREA_FLAG_DRAWSPLIT_V (1 << 5)
|
||||
enum {
|
||||
HEADER_NO_PULLDOWN = (1 << 0),
|
||||
AREA_FLAG_DRAWJOINTO = (1 << 1),
|
||||
AREA_FLAG_DRAWJOINFROM = (1 << 2),
|
||||
AREA_TEMP_INFO = (1 << 3),
|
||||
AREA_FLAG_DRAWSPLIT_H = (1 << 4),
|
||||
AREA_FLAG_DRAWSPLIT_V = (1 << 5),
|
||||
/* used to check if we should switch back to prevspace (of a different type) */
|
||||
AREA_FLAG_TEMP_TYPE = (1 << 6),
|
||||
};
|
||||
|
||||
#define EDGEWIDTH 1
|
||||
#define AREAGRID 4
|
||||
|
||||
@@ -1707,16 +1707,12 @@ static int wm_handler_fileselect_do(bContext *C, ListBase *handlers, wmEventHand
|
||||
|
||||
/* remlink now, for load file case before removing*/
|
||||
BLI_remlink(handlers, handler);
|
||||
|
||||
|
||||
if (val != EVT_FILESELECT_EXTERNAL_CANCEL) {
|
||||
if (screen != handler->filescreen) {
|
||||
ED_screen_full_prevspace(C, CTX_wm_area(C));
|
||||
}
|
||||
else {
|
||||
ED_area_prevspace(C, CTX_wm_area(C));
|
||||
}
|
||||
ScrArea *sa = CTX_wm_area(C);
|
||||
ED_screen_retore_temp_type(C, sa, screen != handler->filescreen);
|
||||
}
|
||||
|
||||
|
||||
wm_handler_op_context(C, handler);
|
||||
|
||||
/* needed for UI_popup_menu_reports */
|
||||
|
||||
Reference in New Issue
Block a user