X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7cfebe05f03443c6f91197f93cd2749270df6666..47710b3b4f26949f92c8ea27b99c7e1bc44c7c3c:/src/mac/carbon/utils.cpp diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 9c4bc2c8ce..d651da7ca9 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -26,8 +26,12 @@ #include #include -#include "MoreFiles.h" -#include "MoreFilesExtras.h" +#ifdef __DARWIN__ +# include "MoreFilesX.h" +#else +# include "MoreFiles.h" +# include "MoreFilesExtras.h" +#endif #ifndef __DARWIN__ #include @@ -362,19 +366,19 @@ wxString wxMacFindFolder( short vol, OSType folderType, Boolean createFolder) { - short vRefNum ; - long dirID ; - wxString strDir ; - - if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr) - { - FSSpec file ; - if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) - { - strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ; - } - } - return strDir ; + short vRefNum ; + long dirID ; + wxString strDir ; + + if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr) + { + FSSpec file ; + if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) + { + strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ; + } + } + return strDir ; } #ifndef __DARWIN__ @@ -461,21 +465,26 @@ int wxDisplayDepth() // Get size of display void wxDisplaySize(int *width, int *height) { - wxClientDisplayRect( NULL , NULL , width , height ) ; + BitMap screenBits; + GetQDGlobalsScreenBits( &screenBits ); + + *width = screenBits.bounds.right - screenBits.bounds.left ; + *height = screenBits.bounds.bottom - screenBits.bounds.top ; } void wxDisplaySizeMM(int *width, int *height) { - wxDisplaySize(width, height); - // on mac 72 is fixed (at least now ;-) - *width *= 25.4 / 72 ; - *height *= 25.4 / 72 ; + wxDisplaySize(width, height); + // on mac 72 is fixed (at least now ;-) + float cvPt2Mm = 25.4 / 72; + *width = int( *width * cvPt2Mm ); + *height = int( *height * cvPt2Mm ); } void wxClientDisplayRect(int *x, int *y, int *width, int *height) { - BitMap screenBits; - GetQDGlobalsScreenBits( &screenBits ); + BitMap screenBits; + GetQDGlobalsScreenBits( &screenBits ); if (x) *x = 0; if (y) *y = 0; @@ -483,15 +492,15 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) *width = screenBits.bounds.right - screenBits.bounds.left ; *height = screenBits.bounds.bottom - screenBits.bounds.top ; - SInt16 mheight ; - #if TARGET_CARBON - GetThemeMenuBarHeight( &mheight ) ; - #else + SInt16 mheight ; +#if TARGET_CARBON + GetThemeMenuBarHeight( &mheight ) ; +#else mheight = LMGetMBarHeight() ; - #endif +#endif *height -= mheight ; if ( y ) - *y = mheight ; + *y = mheight ; } wxWindow* wxFindWindowAtPoint(const wxPoint& pt)