Skip to content

Commit

Permalink
Use the NSPopover's native behavior to close the popover for us, in…
Browse files Browse the repository at this point in the history
…stead of assuming responsibility for closing the popover in the app.
  • Loading branch information
sbruens committed Feb 21, 2024
1 parent eaacd83 commit 166ae71
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/cordova/apple/xcode/macos/Outline/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,10 @@ - (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
self.statusItem.button.action = @selector(togglePopover);
[self setAppIcon:@"StatusBarButtonImage"];
self.popover = [[NSPopover alloc] init];
self.popover.behavior = NSPopoverBehaviorTransient;
self.popover.contentViewController = [[NSViewController alloc] initWithNibName:@"MainViewController"
bundle:[NSBundle mainBundle]];
self.popover.contentViewController.view = self.window.contentView;
// Monitor clicks outside the popover in order to close it.
NSEventMask eventMask = NSEventMaskLeftMouseDown|NSEventMaskRightMouseDown;
self.eventMonitor = [[EventMonitor alloc] initWithMask:eventMask handler:^(NSEvent* event) {
if (self.popover.isShown) {
[self closePopover];
}
}];

if ([self wasStartedByLauncherApp]) {
[OutlineVpn.shared startLastSuccessfulTunnel:^(enum ErrorCode errorCode) {
Expand Down

0 comments on commit 166ae71

Please sign in to comment.