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

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: update 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 | « ui/base/cocoa/base_view.h ('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..ad1f1fec6f90c3ad8e7f2f987c60891247e5bb93 100644
--- a/ui/base/cocoa/base_view.mm
+++ b/ui/base/cocoa/base_view.mm
@@ -8,26 +8,15 @@ NSString* kViewDidBecomeFirstResponder =
@"Chromium.kViewDidBecomeFirstResponder";
NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
-@implementation BaseView
+const int kTrackingOptions = NSTrackingMouseMoved |
+ NSTrackingMouseEnteredAndExited |
+ NSTrackingActiveAlways;
-- (id)initWithFrame:(NSRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- trackingArea_ =
- [[NSTrackingArea alloc] initWithRect:frame
- options:NSTrackingMouseMoved |
- NSTrackingMouseEnteredAndExited |
- NSTrackingActiveInActiveApp |
- NSTrackingInVisibleRect
- owner:self
- userInfo:nil];
- [self addTrackingArea:trackingArea_];
- }
- return self;
-}
+@implementation BaseView
- (void)dealloc {
- [self removeTrackingArea:trackingArea_];
+ if (trackingArea_)
+ [self removeTrackingArea:trackingArea_];
[trackingArea_ release];
[super dealloc];
@@ -143,4 +132,20 @@ NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
return new_rect;
}
+- (void)updateTrackingAreas {
+ [super updateTrackingAreas];
+
+ // 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.
+ if (trackingArea_)
+ [self removeTrackingArea:trackingArea_];
+ [trackingArea_ release];
+ trackingArea_ = [[NSTrackingArea alloc] initWithRect:[self frame]
+ options:kTrackingOptions
+ owner:self
+ userInfo:nil];
+ [self addTrackingArea:trackingArea_];
+}
+
@end
« no previous file with comments | « ui/base/cocoa/base_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698