diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-02-02 13:13:11 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-02-02 13:13:11 +0100 |
| commit | 95e5b1b9c5ffea34c01becd518b11542d597daf8 (patch) | |
| tree | 557318df418148c17aafd6410f0cc206ace4cd8f /src/drivers | |
| parent | 3f56b8091d8e48c9d5bf82c9459dac61c49df9c6 (diff) | |
macOS: remove code present only to support macOS versions 10.6 and earlier - cont'd.
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm | 33 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 24 |
2 files changed, 5 insertions, 52 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm index b3f7fcb61..561aa2ce5 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm @@ -117,26 +117,10 @@ static NSOpenGLPixelFormat* mode_to_NSOpenGLPixelFormat(int m, const int *alistp attribs[n++] = NSOpenGLPFASampleBuffers; attribs[n++] = (NSOpenGLPixelFormatAttribute)1; attribs[n++] = NSOpenGLPFASamples; attribs[n++] = (NSOpenGLPixelFormatAttribute)4; } -#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 -#define NSOpenGLPFAOpenGLProfile (NSOpenGLPixelFormatAttribute)99 -#define kCGLPFAOpenGLProfile NSOpenGLPFAOpenGLProfile -#define NSOpenGLProfileVersionLegacy (NSOpenGLPixelFormatAttribute)0x1000 -#define NSOpenGLProfileVersion3_2Core (NSOpenGLPixelFormatAttribute)0x3200 -#define kCGLOGLPVersion_Legacy NSOpenGLProfileVersionLegacy -#endif - if (fl_mac_os_version >= 100700) { - attribs[n++] = NSOpenGLPFAOpenGLProfile; - attribs[n++] = (m & FL_OPENGL3) ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy; - } + attribs[n++] = NSOpenGLPFAOpenGLProfile; + attribs[n++] = (m & FL_OPENGL3) ? NSOpenGLProfileVersion3_2Core : NSOpenGLProfileVersionLegacy; } else { while (alistp[n] && n < 30) { - if (alistp[n] == kCGLPFAOpenGLProfile) { - if (fl_mac_os_version < 100700) { - if (alistp[n+1] != kCGLOGLPVersion_Legacy) return nil; - n += 2; - continue; - } - } attribs[n] = (NSOpenGLPixelFormatAttribute)alistp[n]; n++; } @@ -189,12 +173,7 @@ static NSOpenGLContext *create_GLcontext_for_window( if (shared_ctx && !context) context = [[NSOpenGLContext alloc] initWithFormat:pixelformat shareContext:nil]; if (context) { NSView *view = [fl_xid(window) contentView]; - if (view && fl_mac_os_version >= 100700) { - //replaces [view setWantsBestResolutionOpenGLSurface:YES] without compiler warning - typedef void (*bestResolutionIMP)(id, SEL, BOOL); - static bestResolutionIMP addr = (bestResolutionIMP)[NSView instanceMethodForSelector:@selector(setWantsBestResolutionOpenGLSurface:)]; - addr(view, @selector(setWantsBestResolutionOpenGLSurface:), Fl::use_high_res_GL() != 0); - } + [view setWantsBestResolutionOpenGLSurface:(Fl::use_high_res_GL() != 0)]; [context setView:view]; if (Fl_Cocoa_Window_Driver::driver(window)->subRect()) { remove_gl_context_opacity(context); @@ -272,11 +251,9 @@ void Fl_Cocoa_Gl_Window_Driver::after_show() { [shared_gl1_ctxt retain]; } [view addSubview:gl1view]; - #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 - if (fl_mac_os_version >= 100700 && Fl::use_high_res_GL()) { + if (Fl::use_high_res_GL()) { [gl1view setWantsBestResolutionOpenGLSurface:YES]; } - #endif [gl1ctxt setView:gl1view]; remove_gl_context_opacity(gl1ctxt); } @@ -284,7 +261,7 @@ void Fl_Cocoa_Gl_Window_Driver::after_show() { float Fl_Cocoa_Gl_Window_Driver::pixels_per_unit() { - int retina = (fl_mac_os_version >= 100700 && Fl::use_high_res_GL() && Fl_X::flx(pWindow) && + int retina = (Fl::use_high_res_GL() && Fl_X::flx(pWindow) && Fl_Cocoa_Window_Driver::driver(pWindow)->mapped_to_retina()) ? 2 : 1; return retina * Fl_Graphics_Driver::default_driver().scale(); } diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index f8fce7010..55d1bea32 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -85,30 +85,6 @@ void Fl_Cocoa_Window_Driver::draw_begin() void Fl_Cocoa_Window_Driver::draw_end() { - // on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right - // corner. This code draws a little ribbed triangle for dragging. - if (fl_mac_os_version < 100700 && !parent() && is_resizable()) { - int minw, minh, maxw, maxh, set; - set = pWindow->get_size_range(&minw, &minh, &maxw, &maxh, NULL, NULL, NULL); - if (!set || minh != maxh || minw != maxw) { - int dx = Fl::box_dw(pWindow->box())-Fl::box_dx(pWindow->box()); - int dy = Fl::box_dh(pWindow->box())-Fl::box_dy(pWindow->box()); - if (dx<=0) dx = 1; - if (dy<=0) dy = 1; - int x1 = w()-dx-1, x2 = x1, y1 = h()-dx-1, y2 = y1; - Fl_Color c[4] = { - pWindow->color(), - fl_color_average(pWindow->color(), FL_WHITE, 0.7f), - fl_color_average(pWindow->color(), FL_BLACK, 0.6f), - fl_color_average(pWindow->color(), FL_BLACK, 0.8f), - }; - int i; - for (i=dx; i<12; i++) { - fl_color(c[i&3]); - fl_line(x1--, y1, x2, y2--); - } - } - } if (Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) { CGContextRef my_gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc(); if (shape_data_) CGContextRestoreGState(my_gc); |
