Revision: 29113
http://sourceforge.net/p/bibdesk/svn/29113
Author: hofman
Date: 2025-04-17 08:48:01 +0000 (Thu, 17 Apr 2025)
Log Message:
-----------
Use dispatch_async instead o performSelector:...afterDelay:
Modified Paths:
--------------
trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-16
14:50:36 UTC (rev 29112)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2025-04-17
08:48:01 UTC (rev 29113)
@@ -640,7 +640,15 @@
if (NO == _fvFlags.isRescaling) {
_fvFlags.isRescaling = YES;
// this is only sent in the default runloop mode, so it's not sent
during event tracking
- [self performSelector:@selector(_rescaleComplete) withObject:nil
afterDelay:0.0];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSUInteger scrollIndex = [_selectionIndexes firstIndex];
+ if (NSNotFound != scrollIndex) {
+ // this won't necessarily trigger setNeedsDisplay:, which
we need unconditionally
+ [self scrollRectToVisible:[self
_rectOfIconAtIndex:scrollIndex]];
+ }
+ [_contentView setNeedsDisplay:YES];
+ _fvFlags.isRescaling = NO;
+ });
}
if (_fvFlags.updatingFromSlider == NO)
@@ -1746,12 +1754,6 @@
return ts1->tv_nsec == ts2->tv_nsec && ts1->tv_sec == ts2->tv_sec;
}
-- (void)_setViewNeedsDisplay
-{
- NSAssert(pthread_main_np() != 0, @"main thread required");
- [_contentView setNeedsDisplay:YES];
-}
-
- (void)_recacheIconsWithInfo:(NSDictionary *)info
{
@autoreleasepool {
@@ -1794,7 +1796,7 @@
has changed. Consequently, setNeedsDisplay:YES should be
sufficient.
*/
if (redisplay)
- [self
performSelectorOnMainThread:@selector(_setViewNeedsDisplay) withObject:nil
waitUntilDone:NO];
+ dispatch_async(dispatch_get_main_queue(), ^{ [_contentView
setNeedsDisplay:YES]; });
}
else {
@@ -1939,17 +1941,6 @@
#pragma mark Cache thread
-- (void)_rescaleComplete;
-{
- NSUInteger scrollIndex = [_selectionIndexes firstIndex];
- if (NSNotFound != scrollIndex) {
- // this won't necessarily trigger setNeedsDisplay:, which we need
unconditionally
- [self scrollRectToVisible:[self _rectOfIconAtIndex:scrollIndex]];
- }
- [_contentView setNeedsDisplay:YES];
- _fvFlags.isRescaling = NO;
-}
-
- (void)_enqueueReleaseOperationForIcons:(NSArray *)icons;
{
NSUInteger i, iMax = [icons count];
@@ -2267,13 +2258,6 @@
}
}
-// redraw at full quality after a resize
-- (void)viewDidEndLiveResize
-{
- [_contentView setNeedsDisplay:YES];
- _fvFlags.scheduledLiveResize = NO;
-}
-
// only invoked when autoscrolling or in response to user action
- (NSRect)adjustScroll:(NSRect)proposedVisibleRect
{
@@ -2420,7 +2404,11 @@
// redraw at high quality after scrolling
if (useFastDrawingPath && NO == _fvFlags.scheduledLiveResize && [self
_isFastScrolling]) {
_fvFlags.scheduledLiveResize = YES;
- [self performSelector:@selector(viewDidEndLiveResize) withObject:nil
afterDelay:0 inModes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
+ // redraw at full quality after a resize
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [_contentView setNeedsDisplay:YES];
+ _fvFlags.scheduledLiveResize = NO;
+ });
}
// shadow needs to be scaled as the icon scale changes to approximate the
IconServices shadow
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit