changeset 18411:0f32b34f6ec0 stable

figure.m: Don't make figure N visible when property explicitly set to 'off' (bug #41396) * scripts/plot/util/figure.m: Don't make figure N visible when property explicitly set to 'off' Add test to re-activate existing figure with 'visible' set to 'off'
author Markus Appel <masolomaster3000@googlemail.com>
date Wed, 29 Jan 2014 21:26:13 +0100
parents 61d9ef05b06b
children b06675ef40f2
files scripts/plot/util/figure.m
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/figure.m	Wed Jan 29 15:17:57 2014 -0500
+++ b/scripts/plot/util/figure.m	Wed Jan 29 21:26:13 2014 +0100
@@ -99,8 +99,10 @@
   endif
 
   set (0, "currentfigure", f);
-  ## When switching to figure N, make figure visible and on top of stack.
-  if (! init_new_figure)
+  ## When switching to figure N, make figure visible and on top of stack,
+  ## unless visibility is explicitly switched off
+  if (! init_new_figure && ! any (strcmpi (varargin(1:2:end), "visible")
+                                  && strcmpi (varargin(2:2:end), "off")))
     set (f, "visible", "on");
   endif
 
@@ -116,6 +118,11 @@
 %! unwind_protect
 %!   assert (hf, gcf);
 %!   assert (isfigure (hf));
+%!   hf2 = figure (hf, "visible", "off");
+%!   assert (hf, hf2);
+%!   assert (hf2, gcf);
+%!   assert (isfigure (hf2));
+%!   assert (get (hf2, "visible"), "off");
 %! unwind_protect_cleanup
 %!   close (hf);
 %! end_unwind_protect