Fix T71590: Closing file browser reopens previously closed render view
authorJulian Eisel <eiseljulian@gmail.com>
Thu, 14 Nov 2019 23:23:52 +0000 (00:23 +0100)
committerJulian Eisel <eiseljulian@gmail.com>
Thu, 14 Nov 2019 23:23:52 +0000 (00:23 +0100)
The render view window was never closed actually, just moved behind the
main window. It's properly closed now.

It should also behave more like expected when there already is a
temporary window open (e.g. Preferences).

source/blender/editors/render/render_view.c

index 2052128cb3690f3678084cbaea35a9836cc66004..9849be2a57b4490a258d90ceff2a795f32c2cd67 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <stddef.h>
 
+#include "BLI_listbase.h"
 #include "BLI_utildefines.h"
 
 #include "DNA_scene_types.h"
@@ -163,6 +164,10 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
     }
 
     sa = CTX_wm_area(C);
+    if (BLI_listbase_is_single(&sa->spacedata) == false) {
+      sima = sa->spacedata.first;
+      sima->flag |= SI_PREVSPACE;
+    }
   }
   else if (U.render_display_type == USER_RENDER_DISPLAY_SCREEN) {
     sa = CTX_wm_area(C);
@@ -264,13 +269,8 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
     sima->flag &= ~SI_FULLWINDOW;
   }
 
-  /* test if we have a temp screen in front */
-  if (WM_window_is_temp_screen(win)) {
-    wm_window_lower(win);
-    return OPERATOR_FINISHED;
-  }
   /* determine if render already shows */
-  else if (sima->flag & SI_PREVSPACE) {
+  if (sima->flag & SI_PREVSPACE) {
     sima->flag &= ~SI_PREVSPACE;
 
     if (sima->flag & SI_FULLWINDOW) {
@@ -288,6 +288,10 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
     ED_screen_state_toggle(C, win, sa, SCREENMAXIMIZED);
     return OPERATOR_FINISHED;
   }
+  else if (WM_window_is_temp_screen(win)) {
+    wm_window_close(C, CTX_wm_manager(C), win);
+    return OPERATOR_FINISHED;
+  }
 
   return OPERATOR_PASS_THROUGH;
 }