OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/native_widget_mac_nswindow.h" | 5 #import "ui/views/cocoa/native_widget_mac_nswindow.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #import "ui/views/cocoa/views_nswindow_delegate.h" | 8 #import "ui/views/cocoa/views_nswindow_delegate.h" |
9 #include "ui/views/widget/native_widget_mac.h" | 9 #include "ui/views/widget/native_widget_mac.h" |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // is needed in addition to the -[NSWindow display] override because Cocoa | 52 // is needed in addition to the -[NSWindow display] override because Cocoa |
53 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly | 53 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly |
54 // when ordering in a window for the first time. | 54 // when ordering in a window for the first time. |
55 - (void)orderWindow:(NSWindowOrderingMode)orderingMode | 55 - (void)orderWindow:(NSWindowOrderingMode)orderingMode |
56 relativeTo:(NSInteger)otherWindowNumber { | 56 relativeTo:(NSInteger)otherWindowNumber { |
57 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode]; | 57 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode]; |
58 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; | 58 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; |
59 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil]; | 59 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil]; |
60 } | 60 } |
61 | 61 |
| 62 // NSResponder implementation. |
| 63 |
| 64 - (void)cursorUpdate:(NSEvent*)theEvent { |
| 65 // The cursor provided by the delegate should only be applied within the |
| 66 // content area. This is because we rely on the contentView to track the |
| 67 // mouse cursor and forward cursorUpdate: messages up the responder chain. |
| 68 // The cursorUpdate: isn't handled in BridgedContentView because views-style |
| 69 // SetCapture() conflicts with the way tracking events are processed for |
| 70 // the view during a drag. Since the NSWindow is still in the responder chain |
| 71 // overriding cursorUpdate: here handles both cases. |
| 72 if (!NSPointInRect([theEvent locationInWindow], [[self contentView] frame])) { |
| 73 [super cursorUpdate:theEvent]; |
| 74 return; |
| 75 } |
| 76 |
| 77 NSCursor* cursor = [[self viewsNSWindowDelegate] cursor]; |
| 78 if (cursor) |
| 79 [cursor set]; |
| 80 else |
| 81 [super cursorUpdate:theEvent]; |
| 82 } |
| 83 |
62 @end | 84 @end |
OLD | NEW |