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

Side by Side Diff: chrome/browser/cocoa/tab_strip_view.mm

Issue 112059: Correct the hit testing so that the window controls and title bar will get ta... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « no previous file | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/cocoa/tab_strip_view.h" 5 #include "chrome/browser/cocoa/tab_strip_view.h"
6 6
7 @implementation TabStripView 7 @implementation TabStripView
8 8
9 - (id)initWithFrame:(NSRect)frame { 9 - (id)initWithFrame:(NSRect)frame {
10 self = [super initWithFrame:frame]; 10 self = [super initWithFrame:frame];
11 if (self) { 11 if (self) {
12 // Nothing yet to do here... 12 // Nothing yet to do here...
13 } 13 }
14 return self; 14 return self;
15 } 15 }
16 16
17 - (void)drawRect:(NSRect)rect { 17 - (void)drawRect:(NSRect)rect {
18 NSRect boundsRect = [self bounds]; 18 NSRect boundsRect = [self bounds];
19 NSRect borderRect, contentRect; 19 NSRect borderRect, contentRect;
20 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge); 20 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge);
21 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.3] set]; 21 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.3] set];
22 22
23 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); 23 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
24 } 24 }
25 25
26 // Allows this view to take clicks in background windows. Since it overlaps
27 // the title bar and window buttons, it needs to do this otherwise things like
28 // the close button doesn't work when the window is in the background.
29 - (BOOL)acceptsFirstMouse:(NSEvent*)event {
30 return YES;
31 }
32
33 // Called to determine where in our view hierarchy the click should go. We
34 // want clicks to go to our children (tabs, new tab button, etc), but no click
35 // should ever go to this view. In fact, returning this view breaks things
36 // such as the window buttons and double-clicking the title bar since the
37 // window manager believes there is a view that wants the mouse event. If the
38 // superclass impl says the click should go here, just cheat and return nil.
39 - (NSView*)hitTest:(NSPoint)point {
40 NSView* hit = [super hitTest:point];
41 if ([hit isEqual:self])
42 hit = nil;
43 return hit;
44 }
45
26 @end 46 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698