Mercurial > octave
annotate libinterp/corefcn/cdisplay.c @ 20948:babc439a224f
* cdisplay.c: Add comment explaining existence of file.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 19 Dec 2015 07:57:38 -0600 |
parents | edc4791fbcb2 |
children | e456327188f9 |
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 |
20948
babc439a224f
* cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents:
18932
diff
changeset
|
39 // Programming Note: This file exists so that we can hide system |
babc439a224f
* cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents:
18932
diff
changeset
|
40 // header files that make heavy use of macros and C-style casts in a C |
babc439a224f
* cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents:
18932
diff
changeset
|
41 // language file and avoid warnings about using old-style casts in C++. |
babc439a224f
* cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents:
18932
diff
changeset
|
42 // Please do NOT eliminate this file and move code to display.cc. |
babc439a224f
* cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents:
18932
diff
changeset
|
43 |
18932
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 const char * |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
45 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
|
46 int *dpy_avail) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
47 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 const char *msg = 0; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 *dpy_avail = 0; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 #if defined (OCTAVE_USE_WINDOWS_API) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 HDC hdc = GetDC (0); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 if (hdc) |
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 *dp = GetDeviceCaps (hdc, BITSPIXEL); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 *ht = GetDeviceCaps (hdc, VERTRES); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 *wd = GetDeviceCaps (hdc, HORZRES); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 double ht_mm = GetDeviceCaps (hdc, VERTSIZE); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 double wd_mm = GetDeviceCaps (hdc, HORZSIZE); |
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 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 *ry = *ht * 25.4 / ht_mm; |
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 *dpy_avail = 1; |
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 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 #elif defined (HAVE_FRAMEWORK_CARBON) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
76 CGDirectDisplayID display = CGMainDisplayID (); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 if (display) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 *dp = CGDisplayBitsPerPixel (display); |
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 #else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 /* 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
|
87 this code is not needed (use CGDisplayBitsPerPixel instead). */ |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
88 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 *dp = 32; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 else if (CFStringCompare (pixelEncoding, |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 CFSTR (IO16BitDirectPixels), 0) == 0) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 *dp = 16; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 *dp = 8; |
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 #endif |
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 *ht = CGDisplayPixelsHigh (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 *wd = CGDisplayPixelsWide (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 CGSize sz_mm = CGDisplayScreenSize (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
107 /* 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
|
108 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
|
109 systems, so use double instead. */ |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 double ht_mm = sz_mm.height; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 double wd_mm = sz_mm.width; |
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 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 *ry = *ht * 25.4 / ht_mm; |
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 *dpy_avail = 1; |
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 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 #elif defined (HAVE_X_WINDOWS) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 const char *display_name = getenv ("DISPLAY"); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 if (display_name && *display_name) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
127 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 Display *display = XOpenDisplay (display_name); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
129 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
130 if (display) |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 { |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 Screen *screen = DefaultScreenOfDisplay (display); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 if (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 *dp = DefaultDepthOfScreen (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 *ht = HeightOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 *wd = WidthOfScreen (screen); |
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 int screen_number = XScreenNumberOfScreen (screen); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 double ht_mm = DisplayHeightMM (display, screen_number); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
144 double wd_mm = DisplayWidthMM (display, screen_number); |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
145 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 *rx = *wd * 25.4 / wd_mm; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
147 *ry = *ht * 25.4 / ht_mm; |
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 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 msg = "X11 display has no default screen"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
152 XCloseDisplay (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 *dpy_avail = 1; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 } |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 msg = "unable to open X11 DISPLAY"; |
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 else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
160 msg = "X11 DISPLAY environment variable not set"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
162 #else |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 msg = "no graphical display found"; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 #endif |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
167 |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
168 return msg; |
edc4791fbcb2
avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
169 } |