mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 00:23:58 +00:00
Popovers now appear to work
This commit is contained in:
parent
683ba79ff0
commit
3d9a5a4f91
@ -114,75 +114,114 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)showNetworks {
|
- (void)showNetworks {
|
||||||
if(self.statusItem.button != nil) {
|
NSButton *button = nil;
|
||||||
NSStatusBarButton *button = self.statusItem.button;
|
NSRect frame;
|
||||||
[self.networkListPopover showRelativeToRect:button.bounds
|
if ([self.statusItem respondsToSelector:@selector(button)]) {
|
||||||
ofView:button
|
button = self.statusItem.button;
|
||||||
preferredEdge:NSMinYEdge];
|
frame = button.bounds;
|
||||||
|
} else if ([self.statusItem respondsToSelector:@selector(_button)]) {
|
||||||
|
button = [self.statusItem performSelector:@selector(_button)];
|
||||||
|
frame = button.bounds;
|
||||||
|
} else {
|
||||||
|
NSLog(@"Can't get view. Uh oh.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[self.networkListPopover showRelativeToRect:frame
|
||||||
|
ofView:button
|
||||||
|
preferredEdge:NSMinYEdge];
|
||||||
|
|
||||||
if(self.transientMonitor == nil) {
|
if(self.transientMonitor == nil) {
|
||||||
self.transientMonitor =
|
self.transientMonitor =
|
||||||
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
||||||
handler:^(NSEvent * _Nonnull e) {
|
handler:^(NSEvent * _Nonnull e) {
|
||||||
[NSEvent removeMonitor:self.transientMonitor];
|
[NSEvent removeMonitor:self.transientMonitor];
|
||||||
self.transientMonitor = nil;
|
self.transientMonitor = nil;
|
||||||
[self.networkListPopover close];
|
[self.networkListPopover close];
|
||||||
}];
|
}];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)joinNetwork {
|
- (void)joinNetwork {
|
||||||
if(self.statusItem.button != nil) {
|
NSButton *button = nil;
|
||||||
NSStatusBarButton *button = self.statusItem.button;
|
NSRect frame;
|
||||||
[self.joinNetworkPopover showRelativeToRect:button.bounds
|
if ([self.statusItem respondsToSelector:@selector(button)]) {
|
||||||
ofView:button
|
button = self.statusItem.button;
|
||||||
preferredEdge:NSMinYEdge];
|
frame = button.bounds;
|
||||||
if(self.transientMonitor == nil) {
|
} else if ([self.statusItem respondsToSelector:@selector(_button)]) {
|
||||||
self.transientMonitor =
|
button = [self.statusItem performSelector:@selector(_button)];
|
||||||
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
frame = button.bounds;
|
||||||
handler:^(NSEvent * _Nonnull e) {
|
} else {
|
||||||
[NSEvent removeMonitor:self.transientMonitor];
|
NSLog(@"Can't get view. Uh oh.");
|
||||||
self.transientMonitor = nil;
|
return;
|
||||||
[self.joinNetworkPopover close];
|
}
|
||||||
}];
|
|
||||||
}
|
[self.joinNetworkPopover showRelativeToRect:button.bounds
|
||||||
|
ofView:button
|
||||||
|
preferredEdge:NSMinYEdge];
|
||||||
|
if(self.transientMonitor == nil) {
|
||||||
|
self.transientMonitor =
|
||||||
|
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
||||||
|
handler:^(NSEvent * _Nonnull e) {
|
||||||
|
[NSEvent removeMonitor:self.transientMonitor];
|
||||||
|
self.transientMonitor = nil;
|
||||||
|
[self.joinNetworkPopover close];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showPreferences {
|
- (void)showPreferences {
|
||||||
if(self.statusItem.button != nil) {
|
NSButton *button = nil;
|
||||||
NSStatusBarButton *button = self.statusItem.button;
|
NSRect frame;
|
||||||
[self.preferencesPopover showRelativeToRect:button.bounds
|
if ([self.statusItem respondsToSelector:@selector(button)]) {
|
||||||
ofView:button
|
button = self.statusItem.button;
|
||||||
preferredEdge:NSMinYEdge];
|
frame = button.bounds;
|
||||||
if(self.transientMonitor == nil) {
|
} else if ([self.statusItem respondsToSelector:@selector(_button)]) {
|
||||||
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
button = [self.statusItem performSelector:@selector(_button)];
|
||||||
handler:^(NSEvent * _Nonnull e) {
|
frame = button.bounds;
|
||||||
[NSEvent removeMonitor:self.transientMonitor];
|
} else {
|
||||||
self.transientMonitor = nil;
|
NSLog(@"Can't get view. Uh oh.");
|
||||||
[self.preferencesPopover close];
|
return;
|
||||||
}];
|
}
|
||||||
}
|
|
||||||
|
[self.preferencesPopover showRelativeToRect:button.bounds
|
||||||
|
ofView:button
|
||||||
|
preferredEdge:NSMinYEdge];
|
||||||
|
if(self.transientMonitor == nil) {
|
||||||
|
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
||||||
|
handler:^(NSEvent * _Nonnull e) {
|
||||||
|
[NSEvent removeMonitor:self.transientMonitor];
|
||||||
|
self.transientMonitor = nil;
|
||||||
|
[self.preferencesPopover close];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showAbout {
|
- (void)showAbout {
|
||||||
if(self.statusItem.button != nil) {
|
NSButton *button = nil;
|
||||||
NSStatusBarButton *button = self.statusItem.button;
|
NSRect frame;
|
||||||
[self.aboutPopover showRelativeToRect:button.bounds
|
if ([self.statusItem respondsToSelector:@selector(button)]) {
|
||||||
ofView:button
|
button = self.statusItem.button;
|
||||||
preferredEdge:NSMinYEdge];
|
frame = button.bounds;
|
||||||
if(self.transientMonitor == nil) {
|
} else if ([self.statusItem respondsToSelector:@selector(_button)]) {
|
||||||
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
button = [self.statusItem performSelector:@selector(_button)];
|
||||||
handler:^(NSEvent * _Nonnull e) {
|
frame = button.bounds;
|
||||||
[NSEvent removeMonitor:self.transientMonitor];
|
} else {
|
||||||
self.transientMonitor = nil;
|
NSLog(@"Can't get view. Uh oh.");
|
||||||
[self.aboutPopover close];
|
return;
|
||||||
}];
|
}
|
||||||
}
|
|
||||||
|
[self.aboutPopover showRelativeToRect:button.bounds
|
||||||
|
ofView:button
|
||||||
|
preferredEdge:NSMinYEdge];
|
||||||
|
if(self.transientMonitor == nil) {
|
||||||
|
[NSEvent addGlobalMonitorForEventsMatchingMask:(NSLeftMouseDown|NSRightMouseDown|NSOtherMouseDown)
|
||||||
|
handler:^(NSEvent * _Nonnull e) {
|
||||||
|
[NSEvent removeMonitor:self.transientMonitor];
|
||||||
|
self.transientMonitor = nil;
|
||||||
|
[self.aboutPopover close];
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)quit {
|
- (void)quit {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user