summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/infobar_controller.mm
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 21:37:57 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-13 21:37:57 +0000
commitb6eb23025f4e3db115522faa1f26a71e606e54eb (patch)
treea3a0ab901e232e24528b035ab6b453428816e670 /chrome/browser/cocoa/infobar_controller.mm
parent871705000b207773317b6494db5726b3ae4e5942 (diff)
downloadchromium_src-b6eb23025f4e3db115522faa1f26a71e606e54eb.zip
chromium_src-b6eb23025f4e3db115522faa1f26a71e606e54eb.tar.gz
chromium_src-b6eb23025f4e3db115522faa1f26a71e606e54eb.tar.bz2
Mac: Let infobar text survive window resizes and fullscreen toggles.
BUG=40604 TEST=Do something that shows an infobar (e.g. go to youtube and kill flash). Switch to and from fullscreen, resize window. Infobar text should stay visible. For infobars with links (e.g. geolocation infobar), the link should still show a hand cursor. Review URL: http://codereview.chromium.org/1654004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/infobar_controller.mm')
-rw-r--r--chrome/browser/cocoa/infobar_controller.mm37
1 files changed, 30 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/infobar_controller.mm b/chrome/browser/cocoa/infobar_controller.mm
index ad0c2b1..6f743f51 100644
--- a/chrome/browser/cocoa/infobar_controller.mm
+++ b/chrome/browser/cocoa/infobar_controller.mm
@@ -26,6 +26,7 @@ const float kAnimateCloseDuration = 0.12;
// This simple subclass of |NSTextView| just doesn't show the (text) cursor
// (|NSTextView| displays the cursor with full keyboard accessibility enabled).
@interface InfoBarTextView : NSTextView
+- (void)fixupCursor;
@end
@implementation InfoBarTextView
@@ -36,18 +37,40 @@ const float kAnimateCloseDuration = 0.12;
return NO;
}
-- (void)resetCursorRects {
- // Do not show the ibeam cursor. Required for when the cursor is inside of the
- // text view but outside of the attributed string.
- [self addCursorRect:[self frame] cursor:[NSCursor arrowCursor]];
-}
-
- (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange
granularity:(NSSelectionGranularity)granularity {
// Do not allow selections.
return NSMakeRange(0, 0);
}
+// Convince NSTextView to not show an I-Beam cursor when the cursor is over the
+// text view but not over actual text.
+//
+// http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg10791.html
+// "NSTextView sets the cursor over itself dynamically, based on considerations
+// including the text under the cursor. It does so in -mouseEntered:,
+// -mouseMoved:, and -cursorUpdate:, so those would be points to consider
+// overriding."
+- (void)mouseMoved:(NSEvent*)e {
+ [super mouseMoved:e];
+ [self fixupCursor];
+}
+
+- (void)mouseEntered:(NSEvent*)e {
+ [super mouseEntered:e];
+ [self fixupCursor];
+}
+
+- (void)cursorUpdate:(NSEvent*)e {
+ [super cursorUpdate:e];
+ [self fixupCursor];
+}
+
+- (void)fixupCursor {
+ if ([[NSCursor currentCursor] isEqual:[NSCursor IBeamCursor]])
+ [[NSCursor arrowCursor] set];
+}
+
@end
@interface InfoBarController (PrivateMethods)
@@ -210,7 +233,7 @@ const float kAnimateCloseDuration = 0.12;
[label_.get() setDelegate:self];
[label_.get() setEditable:NO];
[label_.get() setDrawsBackground:NO];
- [label_.get() setHorizontallyResizable:YES];
+ [label_.get() setHorizontallyResizable:NO];
[label_.get() setVerticallyResizable:NO];
}