Skip to content

Commit

Permalink
merge rolfanroni-cva
Browse files Browse the repository at this point in the history
  • Loading branch information
cjwl committed Apr 14, 2015
2 parents 31afa06 + 6621ca4 commit a0336d6
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 48 deletions.
1 change: 0 additions & 1 deletion AppKit/NSApplication.m
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,6 @@ -(int)runModalSession:(NSModalSession)session {
[pool release];
}



return [session stopCode];
}
Expand Down
3 changes: 3 additions & 0 deletions AppKit/NSTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ -(void)_selectTextWithRange:(NSRange)range {
if(_currentEditor==nil){
NSText* editor =[[self window] fieldEditor:YES forObject:self];
_currentEditor = [[cell setUpFieldEditorAttributes: editor] retain];
[_currentEditor setDelegate:self];
[_currentEditor registerForDraggedTypes:[self _draggedTypes]];
[_currentEditor becomeFirstResponder];
}

[cell selectWithFrame:[self bounds] inView:self editor:_currentEditor delegate:self start:range.location length:range.length];
Expand Down
3 changes: 2 additions & 1 deletion AppKit/NSWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ APPKIT_EXPORT NSString * const NSWindowDidEndLiveResizeNotification;
id _delegate;
NSResponder *_firstResponder;

NSTextView *_fieldEditor;
NSTextView *_sharedFieldEditor;
NSTextView *_currentFieldEditor;
NSArray *_draggedTypes;

NSMutableArray *_trackingAreas;
Expand Down
94 changes: 49 additions & 45 deletions AppKit/NSWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ +(Class)frameViewClassForStyleMask:(unsigned int)styleMask {

_delegate=nil;
_firstResponder=self;
_fieldEditor=nil;
_sharedFieldEditor=nil;
_currentFieldEditor=nil;
_draggedTypes=nil;

_trackingAreas=nil;
Expand Down Expand Up @@ -330,7 +331,7 @@ -(void)dealloc {
[_menuView release];
[_contentView release];
[_backgroundColor release];
[_fieldEditor release];
[_sharedFieldEditor release];
[_draggedTypes release];
[_trackingAreas release];
[_autosaveFrameName release];
Expand Down Expand Up @@ -798,9 +799,9 @@ -(void)_makeSureIsOnAScreen {
frame.origin.y=virtual.origin.y-frame.size.height;
}

if(changed){
if(changed)
[self setFrame:frame display:YES];
}

_makeSureIsOnAScreen=NO;
}
#endif
Expand Down Expand Up @@ -874,14 +875,12 @@ -(void)setFrame:(NSRect)newFrame display:(BOOL)display animate:(BOOL)animate {
if(didSize)
[self resetCursorRects];

if(didSize){
if(didSize)
[self postNotificationName:NSWindowDidResizeNotification];
}

if(didMove){
if(didMove)
[self postNotificationName:NSWindowDidMoveNotification];
}


// If you setFrame:display:YES before rearranging views with only setFrame: calls (which do not mark the view for display)
// Cocoa will properly redisplay the views
// So, doing a hard display right here is not the right thing to do, delay it
Expand Down Expand Up @@ -1077,7 +1076,6 @@ -(void)_toolbarSizeDidChangeFromOldHeight:(CGFloat)oldHeight {
[toolbarView setFrameOrigin:toolbarOrigin];

[[self contentView] setAutoresizingMask:NSViewNotSizable];

[self setFrame:frame display:NO animate:NO];

[[self contentView] setAutoresizingMask:mask];
Expand Down Expand Up @@ -1569,7 +1567,8 @@ -(BOOL)acceptsFirstResponder {

-(BOOL)makeFirstResponder:(NSResponder *)responder {

if(_firstResponder==responder)
if(_firstResponder==responder ||
([responder isKindOfClass:[NSControl class]] && _firstResponder==[(NSControl *)responder currentEditor]))
return YES;

if(![_firstResponder resignFirstResponder])
Expand Down Expand Up @@ -1731,26 +1730,39 @@ - (void)enableKeyEquivalentForDefaultButtonCell {
}

-(NSText *)fieldEditor:(BOOL)create forObject:object {
if(create && _fieldEditor==nil){
_fieldEditor=[[NSTextView alloc] init];
NSTextView *newFieldEditor = nil;
if([_delegate respondsToSelector:@selector(windowWillReturnFieldEditor:toObject:)])
newFieldEditor = [_delegate windowWillReturnFieldEditor:self toObject:object];

if(create && newFieldEditor == nil && _sharedFieldEditor == nil)
newFieldEditor = _sharedFieldEditor = [[NSTextView alloc] init];

if (newFieldEditor)
_currentFieldEditor = newFieldEditor;
else
_currentFieldEditor = _sharedFieldEditor;

if (_currentFieldEditor) {
[_currentFieldEditor setHorizontallyResizable:NO];
[_currentFieldEditor setVerticallyResizable:NO];
[_currentFieldEditor setFieldEditor:YES];
[_currentFieldEditor setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
}

[_fieldEditor setHorizontallyResizable:NO];
[_fieldEditor setVerticallyResizable:NO];
[_fieldEditor setFieldEditor:YES];
[_fieldEditor setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];

return _fieldEditor;

return _currentFieldEditor;
}

-(void)endEditingFor:object {
if((NSResponder *)_fieldEditor==_firstResponder){
_firstResponder=self;
[_fieldEditor resignFirstResponder];
if (_currentFieldEditor) {
if ((NSResponder *)_currentFieldEditor == _firstResponder) {
_firstResponder = object;
[_currentFieldEditor resignFirstResponder];
}
[_currentFieldEditor setDelegate:nil];
[_currentFieldEditor removeFromSuperview];
[_currentFieldEditor setString:@""];
_currentFieldEditor = nil;
}
[_fieldEditor setDelegate:nil];
[_fieldEditor removeFromSuperview];
[_fieldEditor setString:@""];
}

-(void)disableScreenUpdatesUntilFlush {
Expand Down Expand Up @@ -2149,8 +2161,7 @@ -(void)sendEvent:(NSEvent *)event {

// Event goes to view, not first responder
[view mouseDown:event];

_mouseDownLocationInWindow=[event locationInWindow];
_mouseDownLocationInWindow=[event locationInWindow];
}
break;

Expand Down Expand Up @@ -2282,11 +2293,9 @@ -(NSPoint)cascadeTopLeftFromPoint:(NSPoint)topLeftPoint {
else
topLeftPoint.y = frame.origin.y + frame.size.height;

if (reposition){
if (reposition)
[self setFrame:frame display:YES];

}

return topLeftPoint;
}

Expand Down Expand Up @@ -2551,7 +2560,6 @@ -(void)_resizeWithOldMenuViewSize:(NSSize)oldSize {
frame=[self frame];
frame.size.height+=(newSize.height-oldSize.height);
// no display because setMenu: is called before awakeFromNib

[self setFrame:frame display:NO];
// do we even need this?
[_backgroundView setNeedsDisplay:YES];
Expand Down Expand Up @@ -2803,21 +2811,17 @@ -(void)platformWindow:(CGWindow *)window frameChanged:(NSRect)frame didSize:(BOO
[_childWindows makeObjectsPerformSelector:@selector(_parentWindowDidChangeFrame:) withObject:self];
[_drawers makeObjectsPerformSelector:@selector(parentWindowDidChangeFrame:) withObject:self];

if (didSize) {
// Don't redraw everything unless we really have to
[_backgroundView setFrameSize:_frame.size];
[_backgroundView setNeedsDisplay:YES];

// And make sure the cursor rect align with the new size
[self resetCursorRects];
}

[self saveFrameUsingName:_autosaveFrameName];

if(didSize){
if (didSize) {
// Don't redraw everything unless we really have to
[_backgroundView setFrameSize:_frame.size];
[_backgroundView setNeedsDisplay:YES];
[self resetCursorRects];
[self saveFrameUsingName:_autosaveFrameName];
[self postNotificationName:NSWindowDidResizeNotification];
}
else{
else
{
[self saveFrameUsingName:_autosaveFrameName];
[self postNotificationName:NSWindowDidMoveNotification];
}
}
Expand Down
2 changes: 1 addition & 1 deletion QuartzCore/CARenderer.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

@interface CALayer(private)
-(void)_setContext:(CALayerContext *)context;
-(NSNumber *)_textureId;
-(void)_setTextureId:(NSNumber *)value;
-(NSNumber *)_textureId;
@end

@implementation CARenderer
Expand Down

0 comments on commit a0336d6

Please sign in to comment.