diff options
| author | Manolo Gouy <Manolo> | 2011-03-04 16:48:10 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2011-03-04 16:48:10 +0000 |
| commit | 1d038565c1aab91cc35411a617aa864387a603c6 (patch) | |
| tree | 6a6138f5561f3684448ea5726b1ac93ce3a71a23 /src | |
| parent | 704ecc048a14a3d9673780469eb6c2d90130f3dd (diff) | |
Mac OS: modified the definition of the fl_mac_os_version global variable to allow v 10.10.10
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8504 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 2 | ||||
| -rw-r--r-- | src/Fl_Device.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 6 | ||||
| -rw-r--r-- | src/fl_font_mac.cxx | 10 | ||||
| -rw-r--r-- | src/fl_set_fonts_mac.cxx | 2 |
5 files changed, 17 insertions, 13 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 56ddc5247..58f492c87 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1140,7 +1140,7 @@ int Fl::handle_(int e, Fl_Window* window) { int ret; Fl_Widget* pbm = belowmouse(); #ifdef __APPLE__ - if (fl_mac_os_version < 0x1050) { + if (fl_mac_os_version < 100500) { // before 10.5, mouse moved events aren't sent to borderless windows such as tooltips Fl_Window *tooltip = Fl_Tooltip::current_window(); int inside = 0; diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx index 2a7ff08be..1bbf0660d 100644 --- a/src/Fl_Device.cxx +++ b/src/Fl_Device.cxx @@ -74,9 +74,13 @@ void Fl_Graphics_Driver::text_extents(const char*t, int n, int& dx, int& dy, int Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( graphics_driver) { #ifdef __APPLE__ - SInt32 version; - Gestalt(gestaltSystemVersion, &version); - fl_mac_os_version = (int)version; + SInt32 versionMajor = 0; + SInt32 versionMinor = 0; + SInt32 versionBugFix = 0; + Gestalt( gestaltSystemVersionMajor, &versionMajor ); + Gestalt( gestaltSystemVersionMinor, &versionMinor ); + Gestalt( gestaltSystemVersionBugFix, &versionBugFix ); + fl_mac_os_version = versionMajor * 10000 + versionMinor * 100 + versionBugFix; #endif }; diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 20fe0d1ef..e1ea25023 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -113,7 +113,7 @@ bool fl_show_iconic; // true if called from iconize() - shows //int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR Window fl_window; Fl_Window *Fl_Window::current_; -int fl_mac_os_version = 0; // the version number of the running Mac OS X (e.g., 0x1064 for 10.6.4) +int fl_mac_os_version = 0; // the version number of the running Mac OS X (e.g., 100604 for 10.6.4) // forward declarations of variables in this file static int got_events = 0; @@ -2868,7 +2868,7 @@ static void createAppleMenu(void) [menuItem setSubmenu:appleMenu]; mainmenu = [[NSMenu alloc] initWithTitle:@""]; [mainmenu addItem:menuItem]; - if (fl_mac_os_version < 0x1060) { + if (fl_mac_os_version < 100600) { // [NSApp setAppleMenu:appleMenu]; // to avoid compiler warning raised by use of undocumented setAppleMenu : [NSApp performSelector:@selector(setAppleMenu:) withObject:appleMenu]; @@ -3228,7 +3228,7 @@ unsigned char *Fl_X::bitmap_from_window_rect(Fl_Window *win, int x, int y, int w win = win->window(); } CGFloat epsilon = 0; - if (fl_mac_os_version >= 0x1060) epsilon = 0.001; + if (fl_mac_os_version >= 100600) epsilon = 0.001; // The epsilon offset is absolutely necessary under 10.6. Without it, the top pixel row and // left pixel column are not read, and bitmap is read shifted by one pixel in both directions. // Under 10.5, we want no offset. diff --git a/src/fl_font_mac.cxx b/src/fl_font_mac.cxx index 14b7d3053..bc777ad12 100644 --- a/src/fl_font_mac.cxx +++ b/src/fl_font_mac.cxx @@ -46,7 +46,7 @@ Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, Fl_Fontsize Size) { q_name = strdup(name); size = Size; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if (fl_mac_os_version >= 0x1050) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also! +if (fl_mac_os_version >= 100500) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also! CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8); fontref = CTFontCreateWithName(str, size, NULL); CGGlyph glyph[2]; @@ -174,7 +174,7 @@ Fl_Font_Descriptor::~Fl_Font_Descriptor() { */ if (this == fl_graphics_driver->font_descriptor()) fl_graphics_driver->font_descriptor(NULL); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (fl_mac_os_version >= 0x1050) { + if (fl_mac_os_version >= 100500) { CFRelease(fontref); for (unsigned i = 0; i < sizeof(width)/sizeof(float*); i++) { if (width[i]) free(width[i]); @@ -278,7 +278,7 @@ static CGFloat surrogate_width(const UniChar *txt, Fl_Font_Descriptor *fl_fontsi static double fl_mac_width(const UniChar* txt, int n, Fl_Font_Descriptor *fl_fontsize) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if (fl_mac_os_version >= 0x1050) { +if (fl_mac_os_version >= 100500) { double retval = 0; UniChar uni; int i; @@ -373,7 +373,7 @@ void Fl_Quartz_Graphics_Driver::text_extents(const char *str8, int n, int &dx, i if (!font_descriptor()) font(FL_HELVETICA, FL_NORMAL_SIZE); Fl_Font_Descriptor *fl_fontsize = font_descriptor(); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if (fl_mac_os_version >= 0x1050) { +if (fl_mac_os_version >= 100500) { CFStringRef str16 = CFStringCreateWithBytes(NULL, (const UInt8*)str8, n, kCFStringEncodingUTF8, false); CFDictionarySetValue (attributes, kCTFontAttributeName, fl_fontsize->fontref); CFAttributedStringRef mastr = CFAttributedStringCreate(kCFAllocatorDefault, str16, attributes); @@ -442,7 +442,7 @@ static void fl_mac_draw(const char *str, int n, float x, float y, Fl_Graphics_Dr // convert to UTF-16 first UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n); #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 - if (fl_mac_os_version >= 0x1050) { + if (fl_mac_os_version >= 100500) { CFStringRef str16 = CFStringCreateWithCharactersNoCopy(NULL, uniStr, n, kCFAllocatorNull); if (str16 == NULL) return; // shd not happen CGColorRef color = flcolortocgcolor(driver->color()); diff --git a/src/fl_set_fonts_mac.cxx b/src/fl_set_fonts_mac.cxx index e2b0d51e3..84d854154 100644 --- a/src/fl_set_fonts_mac.cxx +++ b/src/fl_set_fonts_mac.cxx @@ -70,7 +70,7 @@ Fl_Font Fl::set_fonts(const char* xstarname) { if (fl_free_font > FL_FREE_FONT) return (Fl_Font)fl_free_font; // if already called #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 -if(fl_mac_os_version >= 0x1050) { +if(fl_mac_os_version >= 100500) { //if(CTFontCreateWithFontDescriptor != NULL) {// CTFontCreateWithFontDescriptor != NULL on 10.4 also! int value[1] = {1}; CFDictionaryRef dict = CFDictionaryCreate(NULL, |
