diff src/interp-core/display.h @ 15160:973296940c89 gui

don't start GUI if display is not available * display.cc (display_info::dpy_avail): New data member. (display_info::display_info): Initialize dpy_avail. (display_info::init): Set dpy_avail. (display_info::display_available, display_info::do_display_available): New functions.
author John W. Eaton <jwe@octave.org>
date Sat, 11 Aug 2012 18:15:29 -0400
parents 909a2797935b
children
line wrap: on
line diff
--- a/src/interp-core/display.h	Sat Aug 11 17:58:12 2012 -0400
+++ b/src/interp-core/display.h	Sat Aug 11 18:15:29 2012 -0400
@@ -30,7 +30,7 @@
 protected:
 
   display_info (bool query = true)
-    : ht (1), wd (1), dp (0), rx (72), ry (72)
+    : ht (1), wd (1), dp (0), rx (72), ry (72), dpy_avail (false)
   {
     init (query);
   }
@@ -62,6 +62,11 @@
     return instance_ok () ? instance->do_y_dpi () : 0;
   }
 
+  static bool display_available (void)
+  {
+    return instance_ok () ? instance->do_display_available () : false;
+  }
+
   // To disable querying the window system for defaults, this function
   // must be called before any other display_info function.
   static void no_window_system (void)
@@ -84,6 +89,8 @@
   double rx;
   double ry;
 
+  bool dpy_avail;
+
   int do_height (void) const { return ht; }
   int do_width (void) const { return wd; }
   int do_depth (void) const { return dp; }
@@ -91,6 +98,8 @@
   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; }
+
   void init (bool query = true);
 
   static bool instance_ok (bool query = true);