Mercurial > octave-libgccjit
annotate libinterp/corefcn/cdisplay.c @ 18932:edc4791fbcb2
avoid some old-style cast warnings
* cdisplay.h, cdisplay.c: New files.
Compile C code and headers with C compiler.
* corefcn/module.mk: Include them in the appropriate lists.
* display.cc (display_info::init): Call new octave_get_display_info
function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 17 Jul 2014 11:19:21 -0400 |
parents | |
children |
rev | line source |
---|---|
18932
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 Copyright (C) 2009-2014 John W. Eaton |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 option) any later version. |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 for more details. |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #ifdef HAVE_CONFIG_H |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 #include <config.h> |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #endif |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #include <stdlib.h> |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #if defined (OCTAVE_USE_WINDOWS_API) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include <windows.h> |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #elif defined (HAVE_FRAMEWORK_CARBON) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 #include <Carbon/Carbon.h> |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 #elif defined (HAVE_X_WINDOWS) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 #include <X11/Xlib.h> |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #endif |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "cdisplay.h" |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 const char * |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 octave_get_display_info (int *ht, int *wd, int *dp, double *rx, double *ry, |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 int *dpy_avail) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
42 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 const char *msg = 0; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 *dpy_avail = 0; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
46 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 #if defined (OCTAVE_USE_WINDOWS_API) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 HDC hdc = GetDC (0); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 if (hdc) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 *dp = GetDeviceCaps (hdc, BITSPIXEL); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 *ht = GetDeviceCaps (hdc, VERTRES); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 *wd = GetDeviceCaps (hdc, HORZRES); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
57 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 double ht_mm = GetDeviceCaps (hdc, VERTSIZE); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 double wd_mm = GetDeviceCaps (hdc, HORZSIZE); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 *ry = *ht * 25.4 / ht_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 *dpy_avail = 1; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 #elif defined (HAVE_FRAMEWORK_CARBON) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 CGDirectDisplayID display = CGMainDisplayID (); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 if (display) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 *dp = CGDisplayBitsPerPixel (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 #else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 /* FIXME: This will only work for MacOS > 10.5. For earlier versions |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 this code is not needed (use CGDisplayBitsPerPixel instead). */ |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 *dp = 32; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 else if (CFStringCompare (pixelEncoding, |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 CFSTR (IO16BitDirectPixels), 0) == 0) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 *dp = 16; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 *dp = 8; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 #endif |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 *ht = CGDisplayPixelsHigh (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 *wd = CGDisplayPixelsWide (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
100 CGSize sz_mm = CGDisplayScreenSize (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 /* For MacOS >= 10.6, CGSize is a struct keeping 2 CGFloat |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 values, but the CGFloat typedef is not present on older |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 systems, so use double instead. */ |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 double ht_mm = sz_mm.height; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
107 double wd_mm = sz_mm.width; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
109 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 *ry = *ht * 25.4 / ht_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 *dpy_avail = 1; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
117 #elif defined (HAVE_X_WINDOWS) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
119 const char *display_name = getenv ("DISPLAY"); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 if (display_name && *display_name) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 Display *display = XOpenDisplay (display_name); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 if (display) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
127 Screen *screen = DefaultScreenOfDisplay (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
129 if (screen) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
130 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 *dp = DefaultDepthOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 *ht = HeightOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 *wd = WidthOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
136 int screen_number = XScreenNumberOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
137 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 double ht_mm = DisplayHeightMM (display, screen_number); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 double wd_mm = DisplayWidthMM (display, screen_number); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 *ry = *ht * 25.4 / ht_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
144 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
145 msg = "X11 display has no default screen"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
147 XCloseDisplay (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
148 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 *dpy_avail = 1; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
152 msg = "unable to open X11 DISPLAY"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
153 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 msg = "X11 DISPLAY environment variable not set"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 #else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
158 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
159 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 #endif |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
162 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 return msg; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 } |