diff --git a/lib/libimhex/source/helpers/utils_macos.m b/lib/libimhex/source/helpers/utils_macos.m index 37702bb44..7a304dc6f 100644 --- a/lib/libimhex/source/helpers/utils_macos.m +++ b/lib/libimhex/source/helpers/utils_macos.m @@ -59,6 +59,22 @@ } @end + @interface ImHexAppDelegate : NSObject + @end + + @implementation ImHexAppDelegate + - (void) application:(NSApplication*)sender openFiles:(NSArray*)filenames + { + NSLog(@"A"); + + [NSApp replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; + } + + - (IBAction) clickAction:(id)sender { + NSLog(@"B"); + } + @end + void setupMacosWindowStyle(GLFWwindow *window, bool borderlessWindowMode) { NSWindow* cocoaWindow = glfwGetCocoaWindow(window); @@ -76,6 +92,9 @@ NSButton *closeButton = [cocoaWindow standardWindowButton:NSWindowCloseButton]; [closeButton setAction:@selector(pressed:)]; [closeButton setTarget:[CloseButtonHandler alloc]]; + + NSApplication *app = [NSApplication sharedApplication]; + [app setDelegate:[ImHexAppDelegate alloc]]; } bool isMacosFullScreenModeEnabled(GLFWwindow *window) {