FLTK logo

[master] 8bbedd6 - Fix issue #501: build error under macOS 10.10

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 8bbedd6 - Fix issue #501: build error under macOS 10.10 "ManoloFLTK" Sep 22, 2022  
 
commit 8bbedd65a8c0128ce66d83a17bca2e5027c000b5
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Sep 22 20:12:40 2022 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Sep 22 20:12:40 2022 +0200

    Fix issue #501: build error under macOS 10.10

 FL/mac.H        | 15 +++++++++++++++
 src/Fl_cocoa.mm | 22 +++++++++++++---------
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git FL/mac.H FL/mac.H
index c1748ab..9af98a2 100644
--- FL/mac.H
+++ FL/mac.H
@@ -78,6 +78,21 @@ typedef class FLWindow *Window; // pointer to the FLWindow objective-c class
 #ifndef MAC_OS_X_VERSION_10_14
 #define MAC_OS_X_VERSION_10_14 101400
 #endif
+#ifndef MAC_OS_X_VERSION_10_15
+#define MAC_OS_X_VERSION_10_15 101500
+#endif
+#ifndef MAC_OS_X_VERSION_10_16
+#define MAC_OS_X_VERSION_10_16 101600
+#endif
+#ifndef MAC_OS_VERSION_11_0
+#define MAC_OS_VERSION_11_0 110000
+#endif
+#ifndef MAC_OS_VERSION_12_0
+#define MAC_OS_VERSION_12_0 120000
+#endif
+#ifndef MAC_OS_VERSION_13_0
+#define MAC_OS_VERSION_13_0 130000
+#endif
 
 
 #ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index 89636fd..8b5a705 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -1388,7 +1388,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
       w = Fl::next_window(w);
     }
     if (w) {
-      [Fl_X::i(w)->xid makeKeyWindow];
+      [fl_mac_xid(w) makeKeyWindow];
     }
   }
   fl_unlock_function();
@@ -1562,7 +1562,7 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
   fl_lock_function();
   for (Fl_X *x = Fl_X::first;x;x = x->next) {
     Fl_Window *w = x->w;
-    if ( !w->parent() && ![x->xid isMiniaturized]) {
+    if ( !w->parent() && ![(FLWindow*)x->xid isMiniaturized]) {
       Fl::handle(FL_SHOW, w);
       }
   }
@@ -2939,6 +2939,10 @@ NSOpenGLContext* Fl_Cocoa_Window_Driver::create_GLcontext_for_window(NSOpenGLPix
   return context;
 }
 
+#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0
+#  define NSOpenGLContextParameterSurfaceOpacity NSOpenGLCPSurfaceOpacity
+#endif
+
 void Fl_Cocoa_Window_Driver::remove_gl_context_opacity(NSOpenGLContext *ctx) {
   GLint gl_opacity;
   [ctx getValues:&gl_opacity forParameter:NSOpenGLContextParameterSurfaceOpacity];
@@ -3335,8 +3339,8 @@ void Fl_Cocoa_Window_Driver::size_range() {
     int bt = get_window_frame_sizes(pWindow);
     NSSize minSize = NSMakeSize(int(minw() * s +.5) , int(minh() * s +.5) + bt);
     NSSize maxSize = NSMakeSize(maxw() ? int(maxw() * s + .5):32000, maxh() ? int(maxh() * s +.5) + bt:32000);
-    [i->xid setMinSize:minSize];
-    [i->xid setMaxSize:maxSize];
+    [(FLWindow*)i->xid setMinSize:minSize];
+    [(FLWindow*)i->xid setMaxSize:maxSize];
   }
 }
 
@@ -3367,17 +3371,17 @@ void Fl_Cocoa_Window_Driver::label(const char *name, const char *mininame) {
 void Fl_Cocoa_Window_Driver::show() {
   Fl_X *top = NULL;
   if (parent()) top = Fl_X::i(pWindow->top_window());
-  if (!shown() && (!parent() || (top && ![top->xid isMiniaturized]))) {
+  if (!shown() && (!parent() || (top && ![(FLWindow*)top->xid isMiniaturized]))) {
     makeWindow();
   } else {
     if ( !parent() ) {
       Fl_X *i = Fl_X::i(pWindow);
-      if ([i->xid isMiniaturized]) {
+      if ([(FLWindow*)i->xid isMiniaturized]) {
         i->w->redraw();
-        [i->xid deminiaturize:nil];
+        [(FLWindow*)i->xid deminiaturize:nil];
       }
       if (!fl_capture) {
-        [i->xid makeKeyAndOrderFront:nil];
+        [(FLWindow*)i->xid makeKeyAndOrderFront:nil];
       }
     }
     else pWindow->set_visible();
@@ -4192,7 +4196,7 @@ int Fl_Cocoa_Screen_Driver::dnd(int use_selection)
   localPool = [[NSAutoreleasePool alloc] init];
   Fl_Widget *w = Fl::pushed();
   Fl_Window *win = w->top_window();
-  FLView *myview = (FLView*)[Fl_X::i(win)->xid contentView];
+  FLView *myview = (FLView*)[fl_mac_xid(win) contentView];
   NSEvent *theEvent = [NSApp currentEvent];
 
   int width, height;
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.