[Bf-blender-cvs] [c6d28a9] master: Fix T42754: File-Selector lost on fullscreen exit

Campbell Barton noreply at git.blender.org
Mon Jan 12 15:46:45 CET 2015


Commit: c6d28a94bee211c1d1ce41f364f5c026c4d759f0
Author: Campbell Barton
Date:   Tue Jan 13 01:40:14 2015 +1100
Branches: master
https://developer.blender.org/rBc6d28a94bee211c1d1ce41f364f5c026c4d759f0

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.

===================================================================

M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/screen/screen_edit.c
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/windowmanager/intern/wm_event_system.c

===================================================================

diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index ed24656..b790c65 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -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);
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index c179cfc..3f81408 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -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 {
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 47a08c6..941a7d0 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -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
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e7b3de7..1fc1348 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -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 */




More information about the Bf-blender-cvs mailing list