OLD | NEW |
---|---|
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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1430 | 1430 |
1431 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b { | 1431 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b { |
1432 takesFocusOnlyOnMouseDown_ = b; | 1432 takesFocusOnlyOnMouseDown_ = b; |
1433 } | 1433 } |
1434 | 1434 |
1435 - (void)setCloseOnDeactivate:(BOOL)b { | 1435 - (void)setCloseOnDeactivate:(BOOL)b { |
1436 closeOnDeactivate_ = b; | 1436 closeOnDeactivate_ = b; |
1437 } | 1437 } |
1438 | 1438 |
1439 - (void)mouseEvent:(NSEvent*)theEvent { | 1439 - (void)mouseEvent:(NSEvent*)theEvent { |
1440 | |
Mark Mentovai
2011/03/23 20:01:25
Don’t start a function with a blank line.
| |
1441 // Use hitTest to check whether we're the frontmost view for this mouse | |
1442 // location. If this is not the frontmost view, don't handle the event | |
1443 // here - let the frontmost view handle it. | |
1444 NSView *contentView = [[self window] contentView]; | |
1445 if ([contentView hitTest:[theEvent locationInWindow]] != self) | |
1446 return; | |
1447 | |
1440 // TODO(rohitrao): Probably need to handle other mouse down events here. | 1448 // TODO(rohitrao): Probably need to handle other mouse down events here. |
1441 if ([theEvent type] == NSLeftMouseDown && takesFocusOnlyOnMouseDown_) { | 1449 if ([theEvent type] == NSLeftMouseDown && takesFocusOnlyOnMouseDown_) { |
1442 if (renderWidgetHostView_->render_widget_host_) | 1450 if (renderWidgetHostView_->render_widget_host_) |
1443 renderWidgetHostView_->render_widget_host_->OnMouseActivate(); | 1451 renderWidgetHostView_->render_widget_host_->OnMouseActivate(); |
1444 | 1452 |
1445 // Manually take focus after the click but before forwarding it to the | 1453 // Manually take focus after the click but before forwarding it to the |
1446 // renderer. | 1454 // renderer. |
1447 [[self window] makeFirstResponder:self]; | 1455 [[self window] makeFirstResponder:self]; |
1448 } | 1456 } |
1449 | 1457 |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2863 if (!string) return NO; | 2871 if (!string) return NO; |
2864 | 2872 |
2865 // If the user is currently using an IME, confirm the IME input, | 2873 // If the user is currently using an IME, confirm the IME input, |
2866 // and then insert the text from the service, the same as TextEdit and Safari. | 2874 // and then insert the text from the service, the same as TextEdit and Safari. |
2867 [self confirmComposition]; | 2875 [self confirmComposition]; |
2868 [self insertText:string]; | 2876 [self insertText:string]; |
2869 return YES; | 2877 return YES; |
2870 } | 2878 } |
2871 | 2879 |
2872 @end | 2880 @end |
OLD | NEW |