Adjust key view loop when adding a new document view to a NSClipView.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35631 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wlux 2012-10-04 08:26:01 +00:00
parent d191a23aa4
commit e9a1c95079
2 changed files with 30 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2012-10-04 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSClipView.m (-setDocumentView:, -setNextKeyView:):
Adjust key view loop when adding a new document view.
2012-10-03 Wolfgang Lux <wolfgang.lux@gmail.com> 2012-10-03 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSWindow.m (titleWithRepresentedFilename, * Source/NSWindow.m (titleWithRepresentedFilename,

View file

@ -125,6 +125,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
- (void) setDocumentView: (NSView*)aView - (void) setDocumentView: (NSView*)aView
{ {
NSNotificationCenter *nc; NSNotificationCenter *nc;
NSView *nextKV;
if (_documentView == aView) if (_documentView == aView)
{ {
@ -134,6 +135,12 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
nc = [NSNotificationCenter defaultCenter]; nc = [NSNotificationCenter defaultCenter];
if (_documentView) if (_documentView)
{ {
nextKV = [_documentView nextKeyView];
if ([nextKV isDescendantOf: _documentView])
{
nextKV = nil;
}
[nc removeObserver: self [nc removeObserver: self
name: NSViewFrameDidChangeNotification name: NSViewFrameDidChangeNotification
object: _documentView]; object: _documentView];
@ -152,6 +159,10 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
} }
[_documentView removeFromSuperview]; [_documentView removeFromSuperview];
} }
else
{
nextKV = [self nextKeyView];
}
/* Don't retain this since it's stored in our subviews. */ /* Don't retain this since it's stored in our subviews. */
_documentView = aView; _documentView = aView;
@ -193,7 +204,7 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
object: _documentView]; object: _documentView];
/* /*
* if out document view is a tableview, let it know * if our document view is a tableview, let it know
* when we resize * when we resize
*/ */
if ([_documentView isKindOfClass: [NSTableView class]]) if ([_documentView isKindOfClass: [NSTableView class]])
@ -205,9 +216,12 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
object: self]; object: self];
} }
[self setNextKeyView: _documentView];
if (![_documentView nextKeyView])
[_documentView setNextKeyView: nextKV];
} }
else
/* TODO: Adjust the key view loop to include the new document view */ [self setNextKeyView: nextKV];
[_super_view reflectScrolledClipView: self]; [_super_view reflectScrolledClipView: self];
} }
@ -722,6 +736,14 @@ static inline NSRect integralRect (NSRect rect, NSView *view)
} }
} }
- (void) setNextKeyView: (NSView *)aView
{
if (_documentView && aView != _documentView)
[_documentView setNextKeyView: aView];
else
[super setNextKeyView: aView];
}
/* /*
* NSCoding protocol * NSCoding protocol
*/ */