Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: ui/base/cocoa/base_view.mm

Issue 12330108: mac: Fix sending of mouse moved events after resizing window's lower left corner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: origin Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/cocoa/base_view.mm
diff --git a/ui/base/cocoa/base_view.mm b/ui/base/cocoa/base_view.mm
index d5f89e89aadf8570a0872d8c3ae80d11a3d447a7..a40c2415f83354665e22188e823e364ac3fca67e 100644
--- a/ui/base/cocoa/base_view.mm
+++ b/ui/base/cocoa/base_view.mm
@@ -8,19 +8,19 @@ NSString* kViewDidBecomeFirstResponder =
@"Chromium.kViewDidBecomeFirstResponder";
NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
+const int kTrackingOptions = NSTrackingMouseMoved |
+ NSTrackingMouseEnteredAndExited |
+ NSTrackingActiveAlways;
+
@implementation BaseView
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
- trackingArea_ =
- [[NSTrackingArea alloc] initWithRect:frame
- options:NSTrackingMouseMoved |
- NSTrackingMouseEnteredAndExited |
- NSTrackingActiveInActiveApp |
- NSTrackingInVisibleRect
- owner:self
- userInfo:nil];
+ trackingArea_ = [[NSTrackingArea alloc] initWithRect:frame
Alexei Svitkine (slow) 2013/03/14 00:42:47 Could this just call [self refreshTrackingAreaSize
+ options:kTrackingOptions
+ owner:self
+ userInfo:nil];
[self addTrackingArea:trackingArea_];
}
return self;
@@ -143,4 +143,31 @@ NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
return new_rect;
}
+- (void)refreshTrackingAreaSize {
Alexei Svitkine (slow) 2013/03/14 00:42:47 Should this be called refreshTrackingAreaRect, sin
+ // NSTrackingInVisibleRect doesn't work correctly with Lion's window resizing,
+ // http://crbug.com/176725 / http://openradar.appspot.com/radar?id=2773401 .
+ // Tear down old tracking area and create a new one as workaround.
+ [self removeTrackingArea:trackingArea_];
+ [trackingArea_ release];
+ trackingArea_ = [[NSTrackingArea alloc] initWithRect:[self frame]
+ options:kTrackingOptions
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea_];
+}
+
+- (void)setFrame:(NSRect)newRect {
+ BOOL sizeChanged = !NSEqualSizes([self frame].size, newRect.size);
+ [super setFrame:newRect];
+
+ // NB: -[NSView setFrame:] calls through -setFrameSize:.
+ if (!sizeChanged)
+ [self refreshTrackingAreaSize];
Alexei Svitkine (slow) 2013/03/14 00:42:47 So this is called because -[NSView setFrame:] does
+}
+
+- (void)setFrameSize:(NSSize)newSize {
+ [super setFrameSize:newSize];
+ [self refreshTrackingAreaSize];
+}
+
@end
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698