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) 52 double *rx,
double *ry,
int *dpy_avail)
54 const char *msg = NULL;
58 #if defined (OCTAVE_USE_WINDOWS_API) 60 octave_unused_parameter (dpy_name);
66 *dp = GetDeviceCaps (hdc, BITSPIXEL);
68 *ht = GetDeviceCaps (hdc, VERTRES);
69 *wd = GetDeviceCaps (hdc, HORZRES);
71 double ht_mm = GetDeviceCaps (hdc, VERTSIZE);
72 double wd_mm = GetDeviceCaps (hdc, HORZSIZE);
74 *rx = *wd * 25.4 / wd_mm;
75 *ry = *ht * 25.4 / ht_mm;
80 msg =
"no graphical display found";
82 #elif defined (HAVE_FRAMEWORK_CARBON) 84 octave_unused_parameter (dpy_name);
86 CGDirectDisplayID display = CGMainDisplayID ();
90 #if defined (HAVE_CARBON_CGDISPLAYBITSPERPIXEL) 92 *dp = CGDisplayBitsPerPixel (display);
99 CGDisplayModeRef
mode = CGDisplayCopyDisplayMode (display);
100 CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (
mode);
102 if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0)
104 else if (CFStringCompare (pixelEncoding,
105 CFSTR (IO16BitDirectPixels), 0) == 0)
112 *ht = CGDisplayPixelsHigh (display);
113 *wd = CGDisplayPixelsWide (display);
115 CGSize sz_mm = CGDisplayScreenSize (display);
121 double ht_mm = sz_mm.height;
122 double wd_mm = sz_mm.width;
124 *rx = *wd * 25.4 / wd_mm;
125 *ry = *ht * 25.4 / ht_mm;
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 double ht_mm = DisplayHeightMM (display, screen_number);
153 double wd_mm = DisplayWidthMM (display, screen_number);
155 *rx = *wd * 25.4 / wd_mm;
156 *ry = *ht * 25.4 / ht_mm;
159 msg =
"X11 display has no default screen";
161 XCloseDisplay (display);
166 msg =
"unable to open X11 DISPLAY";
170 octave_unused_parameter (dpy_name);
171 octave_unused_parameter (ht);
172 octave_unused_parameter (wd);
173 octave_unused_parameter (dp);
174 octave_unused_parameter (rx);
175 octave_unused_parameter (ry);
177 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(const char *dpy_name, int *ht, int *wd, int *dp, double *rx, double *ry, int *dpy_avail)