8000 Implement macos AppDelegate by greglucas · Pull Request #27670 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Implement macos AppDelegate #27670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ static int wait_for_stdin() {
}

/* ---------------------------- Cocoa classes ---------------------------- */
@interface MatplotlibAppDelegate : NSObject <NSApplicationDelegate>
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app;
@end

@interface Window : NSWindow
{ PyObject* manager;
Expand Down Expand Up @@ -195,6 +198,7 @@ static void lazy_init(void) {

NSApp = [NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp setDelegate: [[[MatplotlibAppDelegate alloc] init] autorelease]];

// Run our own event loop while waiting for stdin on the Python side
// this is needed to keep the application responsive while waiting for input
Expand Down Expand Up @@ -779,6 +783,12 @@ int mpl_check_modifier(
},
};

@implementation MatplotlibAppDelegate
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
return YES;
}
@end

@interface NavigationToolbar2Handler : NSObject
{ PyObject* toolbar;
NSButton* panbutton;
Expand Down
0