26 #if defined (HAVE_CONFIG_H)
32 #if defined (OCTAVE_USE_WINDOWS_API)
34 #elif defined (HAVE_FRAMEWORK_CARBON)
35 #include <Carbon/Carbon.h>
36 #elif defined (HAVE_X_WINDOWS)
55 double *rx,
double *ry,
int *dpy_avail)
57 const char *msg = NULL;
64 #if defined (OCTAVE_USE_WINDOWS_API)
66 octave_unused_parameter (dpy_name);
72 *dp = GetDeviceCaps (hdc, BITSPIXEL);
74 *ht = GetDeviceCaps (hdc, VERTRES);
75 *wd = GetDeviceCaps (hdc, HORZRES);
77 ht_mm = GetDeviceCaps (hdc, VERTSIZE);
78 wd_mm = GetDeviceCaps (hdc, HORZSIZE);
83 msg =
"no graphical display found";
85 #elif defined (HAVE_FRAMEWORK_CARBON)
87 octave_unused_parameter (dpy_name);
89 CGDirectDisplayID display = CGMainDisplayID ();
93 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL)
95 *dp = CGDisplayBitsPerPixel (display);
102 CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display);
103 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode);
105 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0)
107 else if (CFStringCompare (pixelEncoding,
108 CFSTR (IO16BitDirectPixels), 0) == 0)
115 *ht = CGDisplayPixelsHigh (display);
116 *wd = CGDisplayPixelsWide (display);
118 CGSize sz_mm = CGDisplayScreenSize (display);
124 ht_mm = sz_mm.height;
130 msg =
"no graphical display found";
132 #elif defined (HAVE_X_WINDOWS)
137 Display *display = XOpenDisplay (dpy_name);
141 Screen *screen = DefaultScreenOfDisplay (display);
145 *dp = DefaultDepthOfScreen (screen);
147 *ht = HeightOfScreen (screen);
148 *wd = WidthOfScreen (screen);
150 int screen_number = XScreenNumberOfScreen (screen);
152 ht_mm = DisplayHeightMM (display, screen_number);
153 wd_mm = DisplayWidthMM (display, screen_number);
158 msg =
"X11 display has no default screen";
160 XCloseDisplay (display);
163 msg =
"unable to open X11 DISPLAY";
167 octave_unused_parameter (dpy_name);
168 octave_unused_parameter (ht);
169 octave_unused_parameter (wd);
170 octave_unused_parameter (dp);
171 octave_unused_parameter (rx);
172 octave_unused_parameter (ry);
174 msg =
"no graphical display found";
180 if (wd_mm == 0 || ht_mm == 0)
182 msg =
"screen width or height reported to be zero";
194 *rx = *wd * 25.4 / wd_mm;
195 *ry = *ht * 25.4 / ht_mm;
const char * octave_get_display_info(const char *dpy_name, int *ht, int *wd, int *dp, double *rx, double *ry, int *dpy_avail)