Mercurial > hg > octave-nkf
changeset 17842:7533f4482006
use gnuplot as default graphics toolkit if display is unavailable (bug #40423)
* display.cc (Fhave_window_system): New function.
* __init_fltk__.cc (PKG_ADD): Don't register fltk toolkit unless
window system is available.
* graphics.cc (gtk_manager::gtk_manager): Set default toolkit to
"gnuplot" if display is not available.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 01 Nov 2013 22:14:37 -0400 |
parents | f21f35d9cb42 |
children | 573f865aa8c8 |
files | libinterp/corefcn/display.cc libinterp/corefcn/graphics.cc libinterp/dldfcn/__init_fltk__.cc |
diffstat | 3 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/display.cc +++ b/libinterp/corefcn/display.cc @@ -34,8 +34,15 @@ #include <X11/Xlib.h> #endif +// X11/Xlib defines this and it conflicts with the Complex typedef in +// oct-cmplx.h. +#ifdef Complex +#undef Complex +#endif + #include "singleton-cleanup.h" +#include "defun.h" #include "display.h" #include "error.h" @@ -186,3 +193,13 @@ return retval; } + +DEFUN (have_window_system, , , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} have_window_system ()\n\ +Return true if Octave a window system is available (X11, Windows,\n\ +or Apple OS X) and false otherwise.\n\ +@end deftypefn") +{ + return octave_value (display_info::display_available ()); +}
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -9588,7 +9588,7 @@ : dtk (), available_toolkits (), loaded_toolkits () { #if defined (HAVE_FLTK) - dtk = "fltk"; + dtk = display_info::display_available () ? "fltk" : "gnuplot"; #else dtk = "gnuplot"; #endif
--- a/libinterp/dldfcn/__init_fltk__.cc +++ b/libinterp/dldfcn/__init_fltk__.cc @@ -29,7 +29,7 @@ */ -// PKG_ADD: if (__have_fltk__ ()) register_graphics_toolkit ("fltk"); endif +// PKG_ADD: if (__have_fltk__ () && have_window_system ()) register_graphics_toolkit ("fltk"); endif #ifdef HAVE_CONFIG_H #include <config.h>