23 #if defined (HAVE_CONFIG_H)
29 #if defined (OCTAVE_USE_WINDOWS_API)
31 #elif defined (HAVE_FRAMEWORK_CARBON)
32 #include <Carbon/Carbon.h>
33 #elif defined (HAVE_X_WINDOWS)
58 #if defined (OCTAVE_USE_WINDOWS_API)
64 *dp = GetDeviceCaps (hdc, BITSPIXEL);
66 *ht = GetDeviceCaps (hdc, VERTRES);
67 *wd = GetDeviceCaps (hdc, HORZRES);
69 double ht_mm = GetDeviceCaps (hdc, VERTSIZE);
70 double wd_mm = GetDeviceCaps (hdc, HORZSIZE);
72 *rx = *wd * 25.4 / wd_mm;
73 *ry = *ht * 25.4 / ht_mm;
78 msg =
"no graphical display found";
80 #elif defined (HAVE_FRAMEWORK_CARBON)
82 CGDirectDisplayID display = CGMainDisplayID ();
86 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL)
88 *dp = CGDisplayBitsPerPixel (display);
95 CGDisplayModeRef
mode = CGDisplayCopyDisplayMode (display);
96 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode);
98 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0)
100 else if (CFStringCompare (pixelEncoding,
101 CFSTR (IO16BitDirectPixels), 0) == 0)
108 *ht = CGDisplayPixelsHigh (display);
109 *wd = CGDisplayPixelsWide (display);
111 CGSize sz_mm = CGDisplayScreenSize (display);
117 double ht_mm = sz_mm.height;
118 double wd_mm = sz_mm.width;
120 *rx = *wd * 25.4 / wd_mm;
121 *ry = *ht * 25.4 / ht_mm;
126 msg =
"no graphical display found";
128 #elif defined (HAVE_X_WINDOWS)
130 const char *display_name = getenv (
"DISPLAY");
132 if (display_name && *display_name)
134 Display *display = XOpenDisplay (display_name);
138 Screen *screen = DefaultScreenOfDisplay (display);
142 *dp = DefaultDepthOfScreen (screen);
144 *ht = HeightOfScreen (screen);
145 *wd = WidthOfScreen (screen);
147 int screen_number = XScreenNumberOfScreen (screen);
149 double ht_mm = DisplayHeightMM (display, screen_number);
150 double wd_mm = DisplayWidthMM (display, screen_number);
152 *rx = *wd * 25.4 / wd_mm;
153 *ry = *ht * 25.4 / ht_mm;
156 msg =
"X11 display has no default screen";
158 XCloseDisplay (display);
163 msg =
"unable to open X11 DISPLAY";
166 msg =
"X11 DISPLAY environment variable not set";
170 octave_unused_parameter (ht);
171 octave_unused_parameter (wd);
172 octave_unused_parameter (dp);
173 octave_unused_parameter (rx);
174 octave_unused_parameter (ry);
176 msg =
"no graphical display found";
An image of characters with associated attributes.
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
const char * octave_get_display_info(int *ht, int *wd, int *dp, double *rx, double *ry, int *dpy_avail)