# HG changeset patch # User John W. Eaton # Date 1232647820 18000 # Node ID e17f262a02cd23afe690dc0e5b8a9bc85481254c # Parent 38ee7ce3bc7d065153285c501c12f266f0a81cbf display.cc: get info for windows and os x systems diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-01-22 John W. Eaton + + * display.cc (display_info::init): Get info for Windows and OS X + systems. + 2009-01-22 Jaroslav Hajek * pt-idx.cc (tree_index_expression::lvalue): Correct tmpi when seeing diff --git a/src/display.cc b/src/display.cc --- a/src/display.cc +++ b/src/display.cc @@ -26,10 +26,17 @@ #include -#if defined (HAVE_X_WINDOWS) +#if defined (OCTAVE_USE_WINDOWS_API) +#include +#elif defined (OCTAVE_USE_OS_X_API) +#include +#include +#elif defined (HAVE_X_WINDOWS) #include #endif + + #include "display.h" #include "error.h" @@ -40,11 +47,47 @@ { #if defined (OCTAVE_USE_WINDOWS_API) - warning ("code to find screen properties is missing"); + HDC hdc = GetDC (0); + + if (hdc) + { + dp = GetDeviceCaps (hdc, BITSPIXEL) + + ht = GetDeviceCaps (hdc, VERTRES); + wd = GetDeviceCaps (hdc, HORZRES); + + double ht_mm = GetDeviceCaps (hdc, VERTSIZE); + double wd_mm = GetDeviceCaps (hdc, HORZSIZE); + + rx = wd * 25.4 / wd_mm; + ry = ht * 25.4 / ht_mm; + } + else + warning ("no graphical display found"); + +#elif defined (OCTAVE_USE_OS_X_API) -#elif defined (OCTAVE_USE_COCOA_API) // FIXME -- what should this be called? + CGDirectDisplayID display = CGMainDisplayID (); + + if (display) + { + dp = CGDisplayBitsPerPixel (display); + + ht = CGDisplayPixelsHigh (display); + wd = CGDisplayPixelsWide (display); + + CGSize sz_mm = CGDisplayScreenSize (display); - warning ("code to find screen properties is missing"); + CGFloat ht_mm = sz_mm.height; + CGFloat wd_mm = sz_mm.width; + + rx = wd * 25.4 / wd_mm; + ry = ht * 25.4 / ht_mm; + + std::cerr << depth << " bit depth" << std::endl; + } + else + warning ("no graphical display found"); #elif defined (HAVE_X_WINDOWS)