GNU Octave  9.1.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-2024 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 
41 
42 void display_info::initialize ()
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 DEFMETHOD (have_window_system, interp, , ,
57  doc: /* -*- texinfo -*-
58 @deftypefn {} {@var{tf} =} have_window_system ()
59 Return true if a window system is available (X11, Windows, or Apple OS X)
60 and false otherwise.
61 @seealso{isguirunning}
62 @end deftypefn */)
63 {
64  display_info& dpy_info = interp.get_display_info ();
65 
66  return ovl (dpy_info.display_available ());
67 }
68 
69 OCTAVE_END_NAMESPACE(octave)
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
bool display_available() const
Definition: display.h:68
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Definition: defun.h:111
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
Definition: ovl.h:219