annotate libinterp/corefcn/cdisplay.c @ 21691:263d18409fdf

Eliminate unused variable warnings for conditionally compiled code. We had more or less decided not to bother trying to eliminate all these warnings for cases in which external dependencies are missing. But then we get people trying to fix these in various ways, so we might as well do it for all cases and use a consistent method. * oct-conf-post.in.h (octave_unused_parameter): New function for C++ code and new macro for C code. * mk-octave-config-h.sh: Emit octave_unused_parameter function and macro for octave-config.h. * CSparse.cc, __delaunayn__.cc, __eigs__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __magick_read__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc, audiodevinfo.cc, audioread.cc, ccolamd.cc, cdisplay.c, colamd.cc, convhulln.cc, dSparse.cc, dmperm.cc, fftw.cc, gl-render.cc, lo-error.c, load-save.cc, ls-hdf5.cc, ls-mat5.cc, oct-hdf5-types.cc, ov-base-int.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-bool.cc, ov-cell.cc, ov-class.cc, ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-fcn-handle.cc, ov-fcn-inline.cc, ov-float.cc, ov-flt-complex.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-java.cc, ov-range.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-scalar.cc, ov-str-mat.cc, ov-struct.cc, sparse-chol.cc, sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, sparse-util.cc, symbfact.cc: Use octave_unused_parameter to eliminate warnings for conditionally compiled code.
author John W. Eaton <jwe@octave.org>
date Fri, 13 May 2016 09:36:14 -0400
parents 40de9f8f23a6
children aba2e6293dd8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
24 # include "config.h"
18932
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++.
20949
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
42 // Additionally, on OS X systems, including the Carbon.h header file
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
43 // results in the declaration of a "panic" function that conflicts with
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
44 // Octave's global panic function, so Carbon.h can't be included in any
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
45 // file that also includes Octave's error.h header file.
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
46
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
47 // Please do NOT eliminate this file and move code from here to
e456327188f9 * cdisplay.c: Additional programming notes.
John W. Eaton <jwe@octave.org>
parents: 20948
diff changeset
48 // display.cc.
20948
babc439a224f * cdisplay.c: Add comment explaining existence of file.
John W. Eaton <jwe@octave.org>
parents: 18932
diff changeset
49
18932
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 const char *
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 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
52 int *dpy_avail)
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 const char *msg = 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 *dpy_avail = 0;
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 #if defined (OCTAVE_USE_WINDOWS_API)
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 HDC hdc = GetDC (0);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 if (hdc)
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 *dp = GetDeviceCaps (hdc, BITSPIXEL);
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 *ht = GetDeviceCaps (hdc, VERTRES);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 *wd = GetDeviceCaps (hdc, HORZRES);
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 double ht_mm = GetDeviceCaps (hdc, VERTSIZE);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 double wd_mm = GetDeviceCaps (hdc, HORZSIZE);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 *rx = *wd * 25.4 / wd_mm;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 *ry = *ht * 25.4 / ht_mm;
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 *dpy_avail = 1;
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 else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 msg = "no graphical display found";
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 #elif defined (HAVE_FRAMEWORK_CARBON)
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 CGDirectDisplayID display = CGMainDisplayID ();
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 if (display)
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 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL)
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 *dp = CGDisplayBitsPerPixel (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 #else
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 /* 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
93 this code is not needed (use CGDisplayBitsPerPixel instead). */
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 CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0)
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 *dp = 32;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 else if (CFStringCompare (pixelEncoding,
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 CFSTR (IO16BitDirectPixels), 0) == 0)
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 *dp = 16;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104 *dp = 8;
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 #endif
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 *ht = CGDisplayPixelsHigh (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 *wd = CGDisplayPixelsWide (display);
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 CGSize sz_mm = CGDisplayScreenSize (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 /* 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
114 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
115 systems, so use double instead. */
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 double ht_mm = sz_mm.height;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 double wd_mm = sz_mm.width;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 *rx = *wd * 25.4 / wd_mm;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 *ry = *ht * 25.4 / ht_mm;
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 *dpy_avail = 1;
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 else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 msg = "no graphical display found";
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 #elif defined (HAVE_X_WINDOWS)
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 const char *display_name = getenv ("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 if (display_name && *display_name)
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 Display *display = XOpenDisplay (display_name);
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 if (display)
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 Screen *screen = DefaultScreenOfDisplay (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 if (screen)
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141 {
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 *dp = DefaultDepthOfScreen (screen);
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 *ht = HeightOfScreen (screen);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 *wd = WidthOfScreen (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 int screen_number = XScreenNumberOfScreen (screen);
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 double ht_mm = DisplayHeightMM (display, screen_number);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 double wd_mm = DisplayWidthMM (display, screen_number);
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 *rx = *wd * 25.4 / wd_mm;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153 *ry = *ht * 25.4 / ht_mm;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154 }
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155 else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 msg = "X11 display has no default screen";
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 XCloseDisplay (display);
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160 *dpy_avail = 1;
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 msg = "unable to open X11 DISPLAY";
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 }
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166 msg = "X11 DISPLAY environment variable not set";
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 #else
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169
21691
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
170 octave_unused_parameter (ht);
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
171 octave_unused_parameter (wd);
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
172 octave_unused_parameter (dp);
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
173 octave_unused_parameter (rx);
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
174 octave_unused_parameter (ry);
263d18409fdf Eliminate unused variable warnings for conditionally compiled code.
John W. Eaton <jwe@octave.org>
parents: 21301
diff changeset
175
18932
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 msg = "no graphical display found";
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 #endif
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 return msg;
edc4791fbcb2 avoid some old-style cast warnings
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 }