Skip to content

Commit

Permalink
mac: refine last commit change (trivial)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilledheart committed Aug 20, 2024
1 parent 7295de0 commit a4eaa7e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/mac/YassAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ - (IBAction)OnOptionMenuClicked:(id)sender {
NSStoryboard* storyboard = [NSStoryboard storyboardWithName:@"Main" bundle:nil];
OptionViewController* optionViewController =
(OptionViewController*)[storyboard instantiateControllerWithIdentifier:@"OptionViewController"];
YassViewController* viewController =
(YassViewController*)NSApplication.sharedApplication.mainWindow.contentViewController;
YassViewController* viewController = [YassViewController instance];
[viewController presentViewControllerAsModalWindow:optionViewController];
}

Expand Down
2 changes: 1 addition & 1 deletion src/mac/YassWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- (void)Started;
- (void)StartFailed;
- (void)Stopped;
- (void)toggleDisplayStatus:(BOOL)enable;
- (void)toggleDisplayStatus:(bool)enable;

+ (YassWindowController* __weak)instance;
@end
Expand Down
12 changes: 6 additions & 6 deletions src/mac/YassWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
static YassWindowController* __weak _instance;

@interface YassWindowController ()
- (void)toggleDisplayStatusInternal:(BOOL)enable;
- (void)toggleDisplayStatusInternal:(bool)enable;
@end

@implementation YassWindowController {
Expand Down Expand Up @@ -54,7 +54,7 @@ - (void)windowDidLoad {
[y_status_bar_item_.button
sendActionOn:NSEventMaskLeftMouseDown | NSEventMaskRightMouseDown | NSEventMaskOtherMouseDown];

BOOL enable_status_bar = absl::GetFlag(FLAGS_ui_display_realtime_status) ? TRUE : FALSE;
bool enable_status_bar = absl::GetFlag(FLAGS_ui_display_realtime_status);
[self toggleDisplayStatusInternal:enable_status_bar];

hide_on_closed_ = FALSE;
Expand Down Expand Up @@ -174,17 +174,17 @@ - (void)Stopped {
[viewController Stopped];
}

- (void)toggleDisplayStatus:(BOOL)enable {
- (void)toggleDisplayStatus:(bool)enable {
[self toggleDisplayStatusInternal:enable];
absl::SetFlag(&FLAGS_ui_display_realtime_status, (enable == TRUE ? true : false));
absl::SetFlag(&FLAGS_ui_display_realtime_status, enable);
config::SaveConfig();
}

- (void)toggleDisplayStatusInternal:(BOOL)enable {
- (void)toggleDisplayStatusInternal:(bool)enable {
if (enable && status_bar_item_ == nil) {
status_bar_item_ = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[self UpdateStatusBar];
} else if (enable == FALSE && status_bar_item_ != nil) {
} else if (!enable && status_bar_item_ != nil) {
status_bar_item_ = nil;
status_bar_text_ = nil;
}
Expand Down

0 comments on commit a4eaa7e

Please sign in to comment.