GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
display.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2009-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "singleton-cleanup.h"
31 
32 #include "cdisplay.h"
33 #include "defun.h"
34 #include "display.h"
35 #include "error.h"
36 #include "interpreter.h"
37 #include "ov.h"
38 #include "ovl.h"
39 
40 namespace octave
41 {
43  {
44  int avail = 0;
45 
46  const char *msg
47  = octave_get_display_info (nullptr, &m_ht, &m_wd, &m_dp,
48  &m_rx, &m_ry, &avail);
49 
50  m_dpy_avail = avail;
51 
52  if (msg)
53  m_msg = msg;
54  }
55 }
56 
57 DEFMETHOD (have_window_system, interp, , ,
58  doc: /* -*- texinfo -*-
59 @deftypefn {} {} have_window_system ()
60 Return true if a window system is available (X11, Windows, or Apple OS X)
61 and false otherwise.
62 @seealso{isguirunning}
63 @end deftypefn */)
64 {
65  octave::display_info& dpy_info = interp.get_display_info ();
66 
67  return ovl (dpy_info.display_available ());
68 }
const char * octave_get_display_info(const char *dpy_name, int *ht, int *wd, int *dp, double *rx, double *ry, int *dpy_avail)
Definition: cdisplay.c:54
void initialize(void)
Definition: display.cc:42
bool display_available(void) const
Definition: display.h:68
std::string m_msg
Definition: display.h:87
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:138
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:211