Fix menu flickering on macOS 10.15
This commit is contained in:
@@ -7,7 +7,8 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
||||
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Preferences could not be opened on Catalina
|
||||
- Preferences could not be opened on macOS 10.15
|
||||
- Menu flickering resulting in a hang on macOS 10.15
|
||||
|
||||
## [1.0.1] - 2019-10-04
|
||||
### Fixed
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>14438</string>
|
||||
<string>14465</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.news</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -82,11 +82,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// Get rid of everything that is not needed.
|
||||
- (void)menuDidClose:(NSMenu*)menu {
|
||||
[menu cleanup];
|
||||
}
|
||||
|
||||
/// Generate items for @c FeedGroup menu.
|
||||
- (void)setFeedGroups:(NSArray<FeedGroup*>*)sortedList forMenu:(NSMenu*)menu {
|
||||
[menu insertDefaultHeader];
|
||||
@@ -125,17 +120,21 @@
|
||||
Fetch @c Feed from core data and find deepest visible @c NSMenuItem.
|
||||
@warning @c item and @c feed will often mismatch.
|
||||
*/
|
||||
- (void)updateFeedMenuItem:(NSManagedObjectID*)oid withBlock:(void(^)(Feed *feed, NSMenuItem *item))block {
|
||||
Feed *feed = [[StoreCoordinator getMainContext] objectWithID:oid];
|
||||
if ([feed isKindOfClass:[Feed class]]) {
|
||||
NSMenuItem *item = [self.statusItem.mainMenu deepestItemWithPath:feed.indexPath];
|
||||
if (item) block(feed, item);
|
||||
}
|
||||
- (BOOL)findDeepest:(NSManagedObjectID*)oid feed:(Feed*__autoreleasing*)feed menuItem:(NSMenuItem*__autoreleasing*)item {
|
||||
Feed *f = [[StoreCoordinator getMainContext] objectWithID:oid];
|
||||
if (![f isKindOfClass:[Feed class]]) return NO;
|
||||
NSMenuItem *mi = [self.statusItem.mainMenu deepestItemWithPath:f.indexPath];
|
||||
if (!mi) return NO;
|
||||
*feed = f;
|
||||
*item = mi;
|
||||
return YES;
|
||||
}
|
||||
|
||||
/// Callback method fired when feed has been updated in the background.
|
||||
- (void)articlesUpdated:(NSNotification*)notify {
|
||||
[self updateFeedMenuItem:notify.object withBlock:^(Feed *feed, NSMenuItem *item) {
|
||||
Feed *feed;
|
||||
NSMenuItem *item;
|
||||
if ([self findDeepest:notify.object feed:&feed menuItem:&item]) {
|
||||
// 1. update in-memory unread count
|
||||
UnreadTotal *updated = [UnreadTotal new];
|
||||
updated.total = feed.articles.count;
|
||||
@@ -160,15 +159,17 @@
|
||||
[item setTitleCount:uct.unread];
|
||||
item = item.parentItem;
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
/// Callback method fired when feed icon has changed.
|
||||
- (void)feedIconUpdated:(NSNotification*)notify {
|
||||
[self updateFeedMenuItem:notify.object withBlock:^(Feed *feed, NSMenuItem *item) {
|
||||
Feed *feed;
|
||||
NSMenuItem *item;
|
||||
if ([self findDeepest:notify.object feed:&feed menuItem:&item]) {
|
||||
if (item.submenu.isFeedMenu)
|
||||
item.image = [feed iconImage16];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
- (NSMenuItem*)insertFeedGroupItem:(FeedGroup*)fg;
|
||||
- (void)insertDefaultHeader;
|
||||
// Update menu
|
||||
- (void)cleanup;
|
||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
||||
@end
|
||||
|
||||
@@ -104,12 +104,6 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
|
||||
|
||||
#pragma mark - Update Menu
|
||||
|
||||
/// Replace this menu with a clean @c NSMenu. Copy old @c title and @c delegate to new menu. @b Won't work without supermenu!
|
||||
- (void)cleanup {
|
||||
NSMenu *m = [[NSMenu alloc] initWithTitle:self.title];
|
||||
m.delegate = self.delegate;
|
||||
self.parentItem.submenu = m;
|
||||
}
|
||||
|
||||
/// Loop over default header and enable 'OpenAllUnread' and 'TagMarkAllRead' based on unread count.
|
||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead {
|
||||
|
||||
Reference in New Issue
Block a user