From 28573be6f43909a3d8d48adaad5695844c8c2a02 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Tue, 22 Jan 2008 19:50:50 +0100 Subject: [PATCH] Make text view first responder when leaving full-screen The 'plus' button on the tabline got first responder status when leaving full-screen, which (among other things) looks bad when full keyboard access is enabled. Also some code cleanup. --- src/MacVim/MMFullscreenWindow.m | 5 +++++ src/MacVim/MMVimView.m | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/MacVim/MMFullscreenWindow.m b/src/MacVim/MMFullscreenWindow.m index c30b73d2..5b4cda52 100644 --- a/src/MacVim/MMFullscreenWindow.m +++ b/src/MacVim/MMFullscreenWindow.m @@ -168,6 +168,11 @@ static int numFullscreenWindows = 0; [[target contentView] addSubview:view]; [view setFrameOrigin:oldPosition]; [self close]; + + // Set the text view to initial first responder, otherwise the 'plus' + // button on the tabline steals the first responder status. + [target setInitialFirstResponder:[view textView]]; + [target makeKeyAndOrderFront:self]; // ...but we don't want a focus gained message either, so don't set this diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 69356574..e925239a 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -136,7 +136,7 @@ enum { [tabBarControl setAutoresizingMask:NSViewWidthSizable|NSViewMinYMargin]; - //[tabBarControl setPartnerView:[self textView]]; + //[tabBarControl setPartnerView:textView]; // tab bar resizing only works if awakeFromNib is called (that's where // the NSViewFrameDidChangeNotification callback is installed). Sounds like @@ -244,12 +244,12 @@ enum { - (NSSize)desiredSize { - return [self vimViewSizeForTextViewSize:[[self textView] desiredSize]]; + return [self vimViewSizeForTextViewSize:[textView desiredSize]]; } - (NSSize)minSize { - return [self vimViewSizeForTextViewSize:[[self textView] minSize]]; + return [self vimViewSizeForTextViewSize:[textView minSize]]; } - (NSSize)constrainRows:(int *)r columns:(int *)c toSize:(NSSize)size @@ -782,7 +782,7 @@ enum { // Give all superfluous space to the text view. It might be smaller or // larger than it wants to be, but this is needed during live resizing. NSRect textViewRect = [self textViewRectForVimViewSize:[self frame].size]; - [[self textView] setFrame:textViewRect]; + [textView setFrame:textViewRect]; [self placeScrollbars]; @@ -797,7 +797,7 @@ enum { // a live resize or not -- this is necessary to avoid the window jittering // when the user drags to resize. int constrained[2]; - NSSize textViewSize = [[self textView] frame].size; + NSSize textViewSize = [textView frame].size; [textView constrainRows:&constrained[0] columns:&constrained[1] toSize:textViewSize]; -- 2.11.4.GIT