summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-02-01 16:32:21 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-02-01 16:32:21 +0100
commite0405d2135939d08289205e3a38df329076e16c1 (patch)
tree4d4facf614ba6062a2df194bd14d2f99021cfad7 /src/drivers/Cocoa
parent4be596a30673a67ee7d5a0bdc8095922a498eed5 (diff)
macOS: remove code present only to support macOS versions 10.3 and 10.4.
This is a first step towards removing the code related to support of old macOS versions that are not compatible with C++11 which FLTK 1.5 requires.
Diffstat (limited to 'src/drivers/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm10
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm78
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx10
3 files changed, 6 insertions, 92 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
index d286d46f3..6dff548f0 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Gl_Window_Driver.mm
@@ -1,7 +1,7 @@
//
// Class Fl_Cocoa_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2021-2022 by Bill Spitzak and others.
+// Copyright 2021-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -112,10 +112,8 @@ static NSOpenGLPixelFormat* mode_to_NSOpenGLPixelFormat(int m, const int *alistp
//list[n++] = AGL_STEREO;
attribs[n++] = 6/*NSOpenGLPFAStereo*/;
}
- if ((m & FL_MULTISAMPLE) && fl_mac_os_version >= 100400) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if (m & FL_MULTISAMPLE) {
attribs[n++] = NSOpenGLPFAMultisample; // 10.4
-#endif
attribs[n++] = NSOpenGLPFASampleBuffers; attribs[n++] = (NSOpenGLPixelFormatAttribute)1;
attribs[n++] = NSOpenGLPFASamples; attribs[n++] = (NSOpenGLPixelFormatAttribute)4;
}
@@ -480,8 +478,6 @@ Fl_RGB_Image* Fl_Cocoa_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int
if (factor != 1) {
w *= factor; h *= factor; x *= factor; y *= factor;
}
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if (fl_mac_os_version >= 100500) {
NSWindow *nswin = (NSWindow*)fl_mac_xid(pWindow);
CGImageRef img_full = Fl_Cocoa_Window_Driver::capture_decorated_window_10_5(nswin);
int bt = [nswin frame].size.height - [[nswin contentView] frame].size.height;
@@ -492,8 +488,6 @@ Fl_RGB_Image* Fl_Cocoa_Gl_Window_Driver::capture_gl_rectangle(int x, int y, int
Fl_RGB_Image *rgb = cgimage_to_rgb4(cgimg);
CGImageRelease(cgimg);
return rgb;
- }
-#endif
[(NSOpenGLContext*)glw->context() makeCurrentContext];
// to capture also the overlay and for directGL demo
[(NSOpenGLContext*)glw->context() flushBuffer];
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
index 0df98af7e..f1a769d75 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
+++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm
@@ -1,7 +1,7 @@
//
// Mac OS X-specific printing support (objective-c++) for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010-2024 by Bill Spitzak and others.
+// Copyright 2010-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -107,8 +107,6 @@ int Fl_Cocoa_Printer_Driver::begin_job (int pagecount, int *frompage, int *topag
OSStatus status = 0;
fl_open_display();
Fl_Cocoa_Window_Driver::q_release_context();
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if (fl_mac_os_version >= 100500) {
NSPrintInfo *info = [NSPrintInfo sharedPrintInfo];
NSPrintPanel *panel = [NSPrintPanel printPanel];
//from 10.5
@@ -143,59 +141,6 @@ int Fl_Cocoa_Printer_Driver::begin_job (int pagecount, int *frompage, int *topag
if (*topage > pagecount && pagecount > 0) *topage = pagecount;
}
status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);//from 10.4
- }
- else
-#endif
- {
-#if !defined(__LP64__) || !__LP64__
- Boolean accepted;
- status = PMCreateSession(&printSession);
- if (status != noErr) return 1;
- status = PMCreatePageFormat(&pageFormat);
- status = PMSessionDefaultPageFormat(printSession, pageFormat);
- if (status != noErr) return 1;
- // get pointer to the PMSessionPageSetupDialog Carbon function
- typedef OSStatus (*dialog_f)(PMPrintSession, PMPageFormat, Boolean *);
- static dialog_f f = NULL;
- if (!f) f = (dialog_f)Fl_Darwin_System_Driver::get_carbon_function("PMSessionPageSetupDialog");
- status = (*f)(printSession, pageFormat, &accepted);
- if (status != noErr || !accepted) {
- Fl::first_window()->show();
- return 1;
- }
- status = PMCreatePrintSettings(&printSettings);
- if (status != noErr || printSettings == kPMNoPrintSettings) return 1;
- status = PMSessionDefaultPrintSettings (printSession, printSettings);
- if (status != noErr) return 1;
- PMSetPageRange(printSettings, 1, (UInt32)kPMPrintAllPages);
- // get pointer to the PMSessionPrintDialog Carbon function
- typedef OSStatus (*dialog_f2)(PMPrintSession, PMPrintSettings, PMPageFormat, Boolean *);
- static dialog_f2 f2 = NULL;
- if (!f2) f2 = (dialog_f2)Fl_Darwin_System_Driver::get_carbon_function("PMSessionPrintDialog");
- status = (*f2)(printSession, printSettings, pageFormat, &accepted);
- if (!accepted) status = kPMCancel;
- if (status != noErr) {
- Fl::first_window()->show();
- return 1;
- }
- UInt32 from32, to32;
- PMGetFirstPage(printSettings, &from32);
- if (frompage) *frompage = (int)from32;
- PMGetLastPage(printSettings, &to32);
- if (topage) *topage = (int)to32;
- if(topage && *topage > pagecount) *topage = pagecount;
- CFStringRef mystring[1];
- mystring[0] = kPMGraphicsContextCoreGraphics;
- CFArrayRef array = CFArrayCreate(NULL, (const void **)mystring, 1, &kCFTypeArrayCallBacks);
- PMSessionSetDocumentFormatGeneration_type PMSessionSetDocumentFormatGeneration =
- (PMSessionSetDocumentFormatGeneration_type)Fl_Darwin_System_Driver::get_carbon_function("PMSessionSetDocumentFormatGeneration");
- status = PMSessionSetDocumentFormatGeneration(printSession, kPMDocumentFormatDefault, array, NULL);
- CFRelease(array);
- PMSessionBeginDocumentNoDialog_type PMSessionBeginDocumentNoDialog =
- (PMSessionBeginDocumentNoDialog_type)Fl_Darwin_System_Driver::get_carbon_function("PMSessionBeginDocumentNoDialog");
- status = PMSessionBeginDocumentNoDialog(printSession, printSettings, pageFormat);
-#endif //__LP64__
- }
if (status != noErr) {
if (perr_message) {
@@ -309,19 +254,7 @@ int Fl_Cocoa_Printer_Driver::begin_page (void)
{
OSStatus status = PMSessionBeginPageNoDialog(printSession, pageFormat, NULL);
CGContextRef gc;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if ( &PMSessionGetCGGraphicsContext != NULL ) {
- status = PMSessionGetCGGraphicsContext(printSession, &gc);
- }
- else
-#endif
- {
-#if !defined(__LP64__) || !__LP64__
- PMSessionGetGraphicsContext_type PMSessionGetGraphicsContext =
- (PMSessionGetGraphicsContext_type)Fl_Darwin_System_Driver::get_carbon_function("PMSessionGetGraphicsContext");
- status = PMSessionGetGraphicsContext(printSession, NULL, (void **)&gc);
-#endif
- }
+ status = PMSessionGetCGGraphicsContext(printSession, &gc); // 10.4
driver()->gc(gc);
Fl_Surface_Device::push_current(this);
PMRect pmRect;
@@ -377,13 +310,6 @@ void Fl_Cocoa_Printer_Driver::end_job (void)
fl_alert ("PM Session error %d", (int)status);
}
PMSessionEndDocumentNoDialog(printSession);
-#if !defined(__LP64__) || !__LP64__
- if (fl_mac_os_version < 100500) {
- PMRelease(printSettings);
- PMRelease(pageFormat);
- PMRelease(printSession);
- }
-#endif
Fl_Window *w = Fl::first_window();
if (w) w->show();
}
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
index 15983032f..ac99ab70b 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
@@ -1,7 +1,7 @@
//
// Definition of Apple Cocoa window driver.
//
-// Copyright 1998-2018 by Bill Spitzak and others.
+// Copyright 1998-2026 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -75,12 +75,10 @@ void Fl_Cocoa_Window_Driver::draw_begin()
if (!Fl_Surface_Device::surface()->driver()->has_feature(Fl_Graphics_Driver::NATIVE)) return;
CGContextRef my_gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
if (shape_data_) {
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (shape_data_->mask && (&CGContextClipToMask != NULL)) {
+ if (shape_data_->mask) {
CGContextClipToMask(my_gc, CGRectMake(0,0,w(),h()), shape_data_->mask); // requires Mac OS 10.4
}
CGContextSaveGState(my_gc);
-# endif
}
}
@@ -111,12 +109,10 @@ void Fl_Cocoa_Window_Driver::draw_end()
}
}
}
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
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);
}
-# endif
}
@@ -187,7 +183,6 @@ void Fl_Cocoa_Window_Driver::shape_alpha_(Fl_Image* img, int offset) {
void Fl_Cocoa_Window_Driver::shape(const Fl_Image* img) {
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (shape_data_) {
if (shape_data_->mask) { CGImageRelease(shape_data_->mask); }
}
@@ -203,7 +198,6 @@ void Fl_Cocoa_Window_Driver::shape(const Fl_Image* img) {
else if (d == 0) shape_bitmap_((Fl_Image*)img);
else if (d == 2 || d == 4) shape_alpha_((Fl_Image*)img, d - 1);
else if ((d == 1 || d == 3) && img->count() == 1) shape_alpha_((Fl_Image*)img, 0);
-#endif
pWindow->border(false);
}