# HG changeset patch # User Rik # Date 1375926458 25200 # Node ID efd8963f925f07cc91b20c7054f1b235efe5b2a4 # Parent 9e613baf431ed030b422bd055b1cb27fa1418e8b waitbar.m: Fix 2nd window pop-up when using gnuplot (bug #35773). * scripts/plot/waitbar.m: Fix 2nd window pop-up when using gnuplot (bug #35773). diff --git a/scripts/plot/waitbar.m b/scripts/plot/waitbar.m --- a/scripts/plot/waitbar.m +++ b/scripts/plot/waitbar.m @@ -107,13 +107,16 @@ endif endif else - h = __go_figure__ (NaN, "position", [250, 500, 400, 100], - "numbertitle", "off", - "toolbar", "none", "menubar", "none", - "integerhandle", "off", - "handlevisibility", "callback", - "tag", "waitbar", - varargin{:}); + ## Save and restore current figure + cf = get (0, "currentfigure"); + + h = figure ("position", [250, 500, 400, 100], + "numbertitle", "off", + "toolbar", "none", "menubar", "none", + "integerhandle", "off", + "handlevisibility", "callback", + "tag", "waitbar", + varargin{:}); ax = axes ("parent", h, "xtick", [], "ytick", [], "xlim", [0, 1], "ylim", [0, 1], @@ -129,6 +132,10 @@ msg = "Please wait..."; endif title (ax, msg); + + if (! isempty (cf)) + set (0, "currentfigure", cf); + endif endif drawnow ();