FLTK logo

[master] 568b4f1 - Fix "macOS: fl_open_callback() misses the launch file of an unbundled app" (#1614)

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

[master] 568b4f1 - Fix "macOS: fl_open_callback() misses the launch file of an unbundled app" (#1614) "ManoloFLTK" 07:17 Sep 25  
 
commit 568b4f11c30a3af7dae2154f2235679d7146c6e9
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Fri Sep 25 09:16:42 2026 +0200
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Fri Sep 25 09:16:42 2026 +0200

    Fix "macOS: fl_open_callback() misses the launch file of an unbundled app" (#1614)

 src/Fl_cocoa.mm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git src/Fl_cocoa.mm src/Fl_cocoa.mm
index ed08c6a..f0226ad 100644
--- src/Fl_cocoa.mm
+++ src/Fl_cocoa.mm
@@ -124,6 +124,7 @@ static NSString *fl_filenames_pboard_type =
 static bool in_nsapp_run = false; // true during execution of [NSApp run]
 static NSMutableArray *dropped_files_list = nil; // list of files dropped at app launch
 typedef void (*open_cb_f_type)(const char *);
+static open_cb_f_type open_cb = NULL;
 static Fl_Window *starting_moved_window = NULL; // the moved window which brings its subwins with it
 
 enum { FLTKBreakLoopEvent = 1, FLTKDataReadyEvent };
@@ -1462,7 +1463,6 @@ static FLWindowDelegate *flwindowdelegate_instance = nil;
 @interface FLAppDelegate : NSObject <NSApplicationDelegate>
 {
   @public
-  open_cb_f_type open_cb;
   TSMDocumentID currentDoc;
 }
 - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
@@ -1663,7 +1663,6 @@ static void attempt_close_all_windows() {
 
 
 static void drain_dropped_files_list() {
-  open_cb_f_type open_cb = ((FLAppDelegate*)[NSApp delegate])->open_cb;
   if (!open_cb) {
     [dropped_files_list removeAllObjects];
     [dropped_files_list release];
@@ -1685,8 +1684,8 @@ static void drain_dropped_files_list() {
  * Install an open documents event handler...
  */
 void Fl_Darwin_System_Driver::open_callback(void (*cb)(const char *)) {
+  open_cb = cb;
   fl_open_display();
-  ((FLAppDelegate*)[NSApp delegate])->open_cb = cb;
 }
 
 @implementation FLApplication
[ Direct Link to Message ]
 
     
[ Previous Message ] [ Next Message ]
 
 

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