Skip to content

Commit

Permalink
cocoaui: fix became/resigned key handler in DdbSeekBar, PlaylistHeade…
Browse files Browse the repository at this point in the history
…rView and DdbTabStrip
  • Loading branch information
Oleksiy-Yakovenko committed Nov 29, 2024
1 parent 8bb8403 commit 52935d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
10 changes: 6 additions & 4 deletions plugins/cocoaui/DdbTabStrip/DdbTabStrip.m
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,17 @@ - (void)setup {
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(windowDidBecomeKey:)
name:NSWindowDidBecomeKeyNotification
object:self.window];
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(windowDidBecomeKey:)
name:NSWindowDidResignKeyNotification
object:self.window];
object:nil];
}

- (void)windowDidBecomeKey:(id)sender {
self.needsDisplay = YES;
- (void)windowDidBecomeKey:(NSNotification *)notification {
if (notification.object == self.window) {
self.needsDisplay = YES;
}
}

- (int)tabWidthForIndex:(int)tab {
Expand Down
8 changes: 5 additions & 3 deletions plugins/cocoaui/Playlist/PlaylistHeaderView.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,19 @@ - (PlaylistHeaderView *)initWithFrame:(NSRect)rect {
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(windowDidBecomeOrResignKey:)
name:NSWindowDidBecomeKeyNotification
object:self.window];
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(windowDidBecomeOrResignKey:)
name:NSWindowDidResignKeyNotification
object:self.window];
object:nil];

return self;
}

- (void)windowDidBecomeOrResignKey:(NSNotification *)notification {
self.needsDisplay = YES;
if (notification.object == self.window) {
self.needsDisplay = YES;
}
}

- (void)drawColumnHeader:(DdbListviewCol_t)col inRect:(NSRect)rect {
Expand Down
6 changes: 6 additions & 0 deletions plugins/cocoaui/widgets/DdbSeekBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ - (void)updateThumbColors {
}

- (void)becameKey:(NSNotification *)notification {
if (notification.object != self.window) {
return;
}
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
self.isKey = YES;
Expand All @@ -242,6 +245,9 @@ - (void)becameKey:(NSNotification *)notification {
}

- (void)resignedKey:(NSNotification *)notification {
if (notification.object != self.window) {
return;
}
[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
self.isKey = NO;
Expand Down

0 comments on commit 52935d9

Please sign in to comment.