Mercurial > hg > octave-nkf
changeset 17828:6b787e274eb1
make -q suppress no graphical display startup message (bug #38937)
* display.h, display.cc (display_info::err_msg): New member variable.
(display_info::display_available): Return initialization error message.
(display_info::init): Set err_message instead of calling warning.
* octave.cc (check_starting_gui): Maybe display display_info
initialization error message as a warning message.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 01 Nov 2013 21:42:06 -0400 |
parents | 2de613986374 |
children | c2d9d42f4fe1 |
files | libinterp/corefcn/display.cc libinterp/corefcn/display.h libinterp/octave.cc |
diffstat | 3 files changed, 35 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/display.cc +++ b/libinterp/corefcn/display.cc @@ -83,7 +83,7 @@ dpy_avail = true; } else - warning ("no graphical display found"); + err_msg = "no graphical display found"; #elif defined (HAVE_FRAMEWORK_CARBON) @@ -115,7 +115,7 @@ dpy_avail = true; } else - warning ("no graphical display found"); + err_msg = "no graphical display found"; #elif defined (HAVE_X_WINDOWS) @@ -145,20 +145,20 @@ ry = ht * 25.4 / ht_mm; } else - warning ("X11 display has no default screen"); + err_msg = "X11 display has no default screen"; XCloseDisplay (display); dpy_avail = true; } else - warning ("unable to open X11 DISPLAY"); + err_msg = "unable to open X11 DISPLAY"; } else - warning ("X11 DISPLAY environment variable not set"); + err_msg = "X11 DISPLAY environment variable not set"; #else - warning ("no graphical display found"); + err_msg = "no graphical display found"; #endif }
--- a/libinterp/corefcn/display.h +++ b/libinterp/corefcn/display.h @@ -23,6 +23,8 @@ #if !defined (octave_display_h) #define octave_display_h 1 +#include <string> + class Matrix; class display_info @@ -30,7 +32,8 @@ protected: display_info (bool query = true) - : ht (1), wd (1), dp (0), rx (72), ry (72), dpy_avail (false) + : ht (1), wd (1), dp (0), rx (72), ry (72), dpy_avail (false), + err_msg () { init (query); } @@ -64,7 +67,13 @@ static bool display_available (void) { - return instance_ok () ? instance->do_display_available () : false; + std::string msg; + return instance_ok () ? instance->do_display_available (msg) : false; + } + + static bool display_available (std::string& msg) + { + return instance_ok () ? instance->do_display_available (msg) : false; } // To disable querying the window system for defaults, this function @@ -91,6 +100,8 @@ bool dpy_avail; + std::string err_msg; + int do_height (void) const { return ht; } int do_width (void) const { return wd; } int do_depth (void) const { return dp; } @@ -98,7 +109,12 @@ double do_x_dpi (void) const { return rx; } double do_y_dpi (void) const { return ry; } - bool do_display_available (void) const { return dpy_avail; } + bool do_display_available (std::string& msg) const + { + msg = err_msg; + + return dpy_avail; + } void init (bool query = true);
--- a/libinterp/octave.cc +++ b/libinterp/octave.cc @@ -891,9 +891,18 @@ static bool check_starting_gui (void) { - if (no_window_system || ! display_info::display_available ()) + if (no_window_system) return false; + std::string err_msg; + if (! display_info::display_available (err_msg)) + { + if (! (inhibit_startup_message || err_msg.empty ())) + warning (err_msg.c_str ()); + + return false; + } + if (force_gui_option) return true;