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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/base/cocoa/base_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/cocoa/base_view.h" 5 #include "ui/base/cocoa/base_view.h"
6 6
7 NSString* kViewDidBecomeFirstResponder = 7 NSString* kViewDidBecomeFirstResponder =
8 @"Chromium.kViewDidBecomeFirstResponder"; 8 @"Chromium.kViewDidBecomeFirstResponder";
9 NSString* kSelectionDirection = @"Chromium.kSelectionDirection"; 9 NSString* kSelectionDirection = @"Chromium.kSelectionDirection";
10 10
11 const int kTrackingOptions = NSTrackingMouseMoved |
12 NSTrackingMouseEnteredAndExited |
13 NSTrackingActiveAlways;
14
11 @implementation BaseView 15 @implementation BaseView
12 16
13 - (id)initWithFrame:(NSRect)frame {
14 self = [super initWithFrame:frame];
15 if (self) {
16 trackingArea_ =
17 [[NSTrackingArea alloc] initWithRect:frame
18 options:NSTrackingMouseMoved |
19 NSTrackingMouseEnteredAndExited |
20 NSTrackingActiveInActiveApp |
21 NSTrackingInVisibleRect
22 owner:self
23 userInfo:nil];
24 [self addTrackingArea:trackingArea_];
25 }
26 return self;
27 }
28
29 - (void)dealloc { 17 - (void)dealloc {
30 [self removeTrackingArea:trackingArea_]; 18 if (trackingArea_)
19 [self removeTrackingArea:trackingArea_];
31 [trackingArea_ release]; 20 [trackingArea_ release];
32 21
33 [super dealloc]; 22 [super dealloc];
34 } 23 }
35 24
36 - (void)mouseEvent:(NSEvent*)theEvent { 25 - (void)mouseEvent:(NSEvent*)theEvent {
37 // This method left intentionally blank. 26 // This method left intentionally blank.
38 } 27 }
39 28
40 - (void)keyEvent:(NSEvent*)theEvent { 29 - (void)keyEvent:(NSEvent*)theEvent {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 new_rect.set_y(NSHeight([self bounds]) - new_rect.bottom()); 125 new_rect.set_y(NSHeight([self bounds]) - new_rect.bottom());
137 return new_rect; 126 return new_rect;
138 } 127 }
139 128
140 - (NSRect)flipRectToNSRect:(gfx::Rect)rect { 129 - (NSRect)flipRectToNSRect:(gfx::Rect)rect {
141 NSRect new_rect(NSRectFromCGRect(rect.ToCGRect())); 130 NSRect new_rect(NSRectFromCGRect(rect.ToCGRect()));
142 new_rect.origin.y = NSHeight([self bounds]) - NSMaxY(new_rect); 131 new_rect.origin.y = NSHeight([self bounds]) - NSMaxY(new_rect);
143 return new_rect; 132 return new_rect;
144 } 133 }
145 134
135 - (void)updateTrackingAreas {
136 [super updateTrackingAreas];
137
138 // NSTrackingInVisibleRect doesn't work correctly with Lion's window resizing,
139 // http://crbug.com/176725 / http://openradar.appspot.com/radar?id=2773401 .
140 // Tear down old tracking area and create a new one as workaround.
141 if (trackingArea_)
142 [self removeTrackingArea:trackingArea_];
143 [trackingArea_ release];
144 trackingArea_ = [[NSTrackingArea alloc] initWithRect:[self frame]
145 options:kTrackingOptions
146 owner:self
147 userInfo:nil];
148 [self addTrackingArea:trackingArea_];
149 }
150
146 @end 151 @end
OLDNEW
« 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