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]
|
## [Unreleased]
|
||||||
### Fixed
|
### 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
|
## [1.0.1] - 2019-10-04
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>14438</string>
|
<string>14465</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.news</string>
|
<string>public.app-category.news</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<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.
|
/// Generate items for @c FeedGroup menu.
|
||||||
- (void)setFeedGroups:(NSArray<FeedGroup*>*)sortedList forMenu:(NSMenu*)menu {
|
- (void)setFeedGroups:(NSArray<FeedGroup*>*)sortedList forMenu:(NSMenu*)menu {
|
||||||
[menu insertDefaultHeader];
|
[menu insertDefaultHeader];
|
||||||
@@ -125,17 +120,21 @@
|
|||||||
Fetch @c Feed from core data and find deepest visible @c NSMenuItem.
|
Fetch @c Feed from core data and find deepest visible @c NSMenuItem.
|
||||||
@warning @c item and @c feed will often mismatch.
|
@warning @c item and @c feed will often mismatch.
|
||||||
*/
|
*/
|
||||||
- (void)updateFeedMenuItem:(NSManagedObjectID*)oid withBlock:(void(^)(Feed *feed, NSMenuItem *item))block {
|
- (BOOL)findDeepest:(NSManagedObjectID*)oid feed:(Feed*__autoreleasing*)feed menuItem:(NSMenuItem*__autoreleasing*)item {
|
||||||
Feed *feed = [[StoreCoordinator getMainContext] objectWithID:oid];
|
Feed *f = [[StoreCoordinator getMainContext] objectWithID:oid];
|
||||||
if ([feed isKindOfClass:[Feed class]]) {
|
if (![f isKindOfClass:[Feed class]]) return NO;
|
||||||
NSMenuItem *item = [self.statusItem.mainMenu deepestItemWithPath:feed.indexPath];
|
NSMenuItem *mi = [self.statusItem.mainMenu deepestItemWithPath:f.indexPath];
|
||||||
if (item) block(feed, item);
|
if (!mi) return NO;
|
||||||
}
|
*feed = f;
|
||||||
|
*item = mi;
|
||||||
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callback method fired when feed has been updated in the background.
|
/// Callback method fired when feed has been updated in the background.
|
||||||
- (void)articlesUpdated:(NSNotification*)notify {
|
- (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
|
// 1. update in-memory unread count
|
||||||
UnreadTotal *updated = [UnreadTotal new];
|
UnreadTotal *updated = [UnreadTotal new];
|
||||||
updated.total = feed.articles.count;
|
updated.total = feed.articles.count;
|
||||||
@@ -160,15 +159,17 @@
|
|||||||
[item setTitleCount:uct.unread];
|
[item setTitleCount:uct.unread];
|
||||||
item = item.parentItem;
|
item = item.parentItem;
|
||||||
}
|
}
|
||||||
}];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Callback method fired when feed icon has changed.
|
/// Callback method fired when feed icon has changed.
|
||||||
- (void)feedIconUpdated:(NSNotification*)notify {
|
- (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)
|
if (item.submenu.isFeedMenu)
|
||||||
item.image = [feed iconImage16];
|
item.image = [feed iconImage16];
|
||||||
}];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
- (NSMenuItem*)insertFeedGroupItem:(FeedGroup*)fg;
|
- (NSMenuItem*)insertFeedGroupItem:(FeedGroup*)fg;
|
||||||
- (void)insertDefaultHeader;
|
- (void)insertDefaultHeader;
|
||||||
// Update menu
|
// Update menu
|
||||||
- (void)cleanup;
|
|
||||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
||||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -104,12 +104,6 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
|
|||||||
|
|
||||||
#pragma mark - Update Menu
|
#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.
|
/// Loop over default header and enable 'OpenAllUnread' and 'TagMarkAllRead' based on unread count.
|
||||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead {
|
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead {
|
||||||
|
|||||||
Reference in New Issue
Block a user