# HG changeset patch # User Markus Appel # Date 1391027173 -3600 # Node ID 0f32b34f6ec0eef2489bfc22c13dce71410e52e9 # Parent 61d9ef05b06bee5340bf916e4fa16a35fb5c9a25 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' diff -r 61d9ef05b06b -r 0f32b34f6ec0 scripts/plot/util/figure.m --- 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