merge with timschmielau-cocotron

This commit is contained in:
Christopher Lloyd 2015-04-26 19:56:18 -04:00
commit 3a4ee557c9
6 changed files with 23 additions and 13 deletions

View File

@ -475,13 +475,13 @@ NSString * const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
if (size.width > _maxContentSize.width && _maxContentSize.width > 0) if (size.width > _maxContentSize.width && _maxContentSize.width > 0)
size.width = _maxContentSize.width; size.width = _maxContentSize.width;
size.height = [self contentSize].height; size.height = _contentSize.height;
} }
else { else {
if (size.height > _maxContentSize.height && _maxContentSize.height > 0) if (size.height > _maxContentSize.height && _maxContentSize.height > 0)
size.height = _maxContentSize.height; size.height = _maxContentSize.height;
size.width = [self contentSize].width; size.width = _contentSize.width;
} }
[self setContentSize:size]; [self setContentSize:size];

View File

@ -929,9 +929,14 @@ _dataSource);
// Deprecated in Mac OS X 10.3. // Deprecated in Mac OS X 10.3.
-(void)selectRow:(int)row byExtendingSelection:(BOOL)extend { -(void)selectRow:(int)row byExtendingSelection:(BOOL)extend {
if (extend) if (extend) {
[self selectRowIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange([self selectedRow], row)] byExtendingSelection:NO]; NSUInteger startRow=[self selectedRow], endRow=row;
else if (startRow>endRow) {
endRow=startRow;
startRow=row;
}
[self selectRowIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(startRow, endRow-startRow+1)] byExtendingSelection:NO];
} else
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; [self selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
} }
@ -1580,7 +1585,7 @@ _dataSource);
startRow = _clickedRow; startRow = _clickedRow;
} }
[self selectRowIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(startRow, endRow)] byExtendingSelection:NO]; [self selectRowIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(startRow, endRow-startRow+1)] byExtendingSelection:NO];
} }
else else
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:_clickedRow] byExtendingSelection:NO]; [self selectRowIndexes:[NSIndexSet indexSetWithIndex:_clickedRow] byExtendingSelection:NO];

View File

@ -175,7 +175,8 @@ APPKIT_EXPORT NSString * const NSWindowDidEndLiveResizeNotification;
BOOL _autorecalculatesKeyViewLoop; BOOL _autorecalculatesKeyViewLoop;
BOOL _hasBeenOnScreen; BOOL _hasBeenOnScreen;
BOOL _inLiveResize; BOOL _isInLiveResize;
BOOL _preservesContentDuringLiveResize;
NSSize _resizeIncrements; NSSize _resizeIncrements;
NSSize _contentResizeIncrements; NSSize _contentResizeIncrements;

View File

@ -290,6 +290,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
_viewsNeedDisplay=YES; _viewsNeedDisplay=YES;
_flushNeeded=YES; _flushNeeded=YES;
_isInLiveResize=NO;
_resizeIncrements=NSMakeSize(1,1); _resizeIncrements=NSMakeSize(1,1);
_contentResizeIncrements=NSMakeSize(1,1); _contentResizeIncrements=NSMakeSize(1,1);
@ -691,6 +693,8 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
{ NSWindowDidResignKeyNotification,@selector(windowDidResignKey:) }, { NSWindowDidResignKeyNotification,@selector(windowDidResignKey:) },
{ NSWindowDidResignMainNotification,@selector(windowDidResignMain:) }, { NSWindowDidResignMainNotification,@selector(windowDidResignMain:) },
{ NSWindowDidResizeNotification,@selector(windowDidResize:) }, { NSWindowDidResizeNotification,@selector(windowDidResize:) },
{ NSWindowWillStartLiveResizeNotification,@selector(windowWillStartLiveResize:) },
{ NSWindowDidEndLiveResizeNotification,@selector(windowDidEndLiveResize:) },
{ NSWindowDidUpdateNotification,@selector(windowDidUpdate:) }, { NSWindowDidUpdateNotification,@selector(windowDidUpdate:) },
{ NSWindowWillCloseNotification,@selector(windowWillClose:) }, { NSWindowWillCloseNotification,@selector(windowWillClose:) },
{ NSWindowWillMiniaturizeNotification,@selector(windowWillMiniaturize:) }, { NSWindowWillMiniaturizeNotification,@selector(windowWillMiniaturize:) },
@ -1429,7 +1433,7 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
} }
-(BOOL)inLiveResize { -(BOOL)inLiveResize {
return _inLiveResize; return _isInLiveResize;
} }
-(BOOL)canBecomeKeyWindow { -(BOOL)canBecomeKeyWindow {
@ -2854,12 +2858,12 @@ NSString * const NSWindowDidAnimateNotification=@"NSWindowDidAnimateNotification
-(void)platformWindowWillBeginSizing:(CGWindow *)window { -(void)platformWindowWillBeginSizing:(CGWindow *)window {
[self postNotificationName:NSWindowWillStartLiveResizeNotification]; [self postNotificationName:NSWindowWillStartLiveResizeNotification];
_inLiveResize=YES; _isInLiveResize=YES;
[_backgroundView viewWillStartLiveResize]; [_backgroundView viewWillStartLiveResize];
} }
-(void)platformWindowDidEndSizing:(CGWindow *)window { -(void)platformWindowDidEndSizing:(CGWindow *)window {
_inLiveResize=NO; _isInLiveResize=NO;
[_backgroundView viewDidEndLiveResize]; [_backgroundView viewDidEndLiveResize];
[self postNotificationName:NSWindowDidEndLiveResizeNotification]; [self postNotificationName:NSWindowDidEndLiveResizeNotification];
} }

View File

@ -399,7 +399,7 @@ static BOOL CALLBACK monitorEnumerator(HMONITOR hMonitor,HDC hdcMonitor,LPRECT r
[[NSRunLoop currentRunLoop] addInputSource:_eventInputSource forMode:mode]; [[NSRunLoop currentRunLoop] addInputSource:_eventInputSource forMode:mode];
[self stopWaitCursor]; [self stopWaitCursor];
while([untilDate timeIntervalSinceNow]>0 || [_eventQueue count]>0){ do{
result=[super nextEventMatchingMask:mask|NSPlatformSpecificDisplayMask untilDate:untilDate inMode:mode dequeue:dequeue]; result=[super nextEventMatchingMask:mask|NSPlatformSpecificDisplayMask untilDate:untilDate inMode:mode dequeue:dequeue];
if([result type]==NSPlatformSpecificDisplayEvent){ if([result type]==NSPlatformSpecificDisplayEvent){
@ -412,7 +412,7 @@ static BOOL CALLBACK monitorEnumerator(HMONITOR hMonitor,HDC hdcMonitor,LPRECT r
if(result!=nil) if(result!=nil)
break; break;
} }while([untilDate timeIntervalSinceNow]>0 || [_eventQueue count]>0);
[self startWaitCursor]; [self startWaitCursor];
// [[NSRunLoop currentRunLoop] removeInputSource:_eventInputSource forMode:mode]; // [[NSRunLoop currentRunLoop] removeInputSource:_eventInputSource forMode:mode];

View File

@ -42,7 +42,7 @@ static inline unsigned OBJCHashString (const void *data) {
result=5381; result=5381;
for(i=0;s[i]!='\0';i++) for(i=0;s[i]!='\0';i++)
result=((result<<5)+result)+s[i]; // hash*33+c result=(((result<<5)|(result>>27))+result)+s[i]; // hash*33 % (2^32-1) + c (barring overflow during additions)
} }
return result; return result;