changeset 21783:58a4c5633efd

Disable plotting graphics when --no-window-system used (bug #48017). * __gnuplot_drawnow__.m: Check have_window_system() rather than DISPLAY environment variable to see whether we should be plotting. * main.in.cc: Check explicitly for --no-window-system option and disable gui if given.
author Rik <rik@octave.org>
date Fri, 27 May 2016 09:47:43 -0700
parents 2aef506f3fec
children d13883644981
files scripts/plot/util/__gnuplot_drawnow__.m src/main.in.cc
diffstat 2 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/__gnuplot_drawnow__.m	Wed May 25 16:51:16 2016 -0400
+++ b/scripts/plot/util/__gnuplot_drawnow__.m	Fri May 27 09:47:43 2016 -0700
@@ -361,7 +361,7 @@
       term = "aqua";
     elseif (! isunix ())
       term = "windows";
-    elseif (! isempty (getenv ("DISPLAY")))
+    elseif (have_window_system ())
       term = "x11";
     else
       term = "dumb";
--- a/src/main.in.cc	Wed May 25 16:51:16 2016 -0400
+++ b/src/main.in.cc	Fri May 27 09:47:43 2016 -0700
@@ -453,6 +453,7 @@
   int k = 1;
 
   bool warn_display = true;
+  bool no_display = false;
 
   for (int i = 1; i < argc; i++)
     {
@@ -485,13 +486,26 @@
           warn_display = false;
           new_argv[k++] = argv[i];
         }
+      else if (! strcmp (argv[i], "--no-window-system")
+               || ! strcmp (argv[i], "-W"))
+        {
+          no_display = true;
+          new_argv[k++] = argv[i];
+        }
       else
         new_argv[k++] = argv[i];
     }
 
   new_argv[k] = 0;
 
-  if (gui_libs || start_gui)
+  if (no_display)
+    {
+      start_gui = false;
+      gui_libs = false;
+
+      file = octave_cli;
+    }
+  else if (gui_libs || start_gui)
     {
       int dpy_avail;