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

Side by Side Diff: ui/views/cocoa/native_widget_mac_nswindow.mm

Issue 891003004: MacViews: Implement SetCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150129-MacViews-Bringup5
Patch Set: cl format Created 5 years, 10 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
OLDNEW
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/controls/menu/menu_controller.h" 9 #include "ui/views/controls/menu/menu_controller.h"
10 #include "ui/views/widget/native_widget_mac.h" 10 #include "ui/views/widget/native_widget_mac.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 // is needed in addition to the -[NSWindow display] override because Cocoa 78 // is needed in addition to the -[NSWindow display] override because Cocoa
79 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly 79 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly
80 // when ordering in a window for the first time. 80 // when ordering in a window for the first time.
81 - (void)orderWindow:(NSWindowOrderingMode)orderingMode 81 - (void)orderWindow:(NSWindowOrderingMode)orderingMode
82 relativeTo:(NSInteger)otherWindowNumber { 82 relativeTo:(NSInteger)otherWindowNumber {
83 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode]; 83 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode];
84 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; 84 [super orderWindow:orderingMode relativeTo:otherWindowNumber];
85 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil]; 85 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil];
86 } 86 }
87 87
88 // NSResponder implementation.
89
90 - (void)cursorUpdate:(NSEvent*)theEvent {
91 // The cursor provided by the delegate should only be applied within the
92 // content area. This is because we rely on the contentView to track the
93 // mouse cursor and forward cursorUpdate: messages up the responder chain.
94 // The cursorUpdate: isn't handled in BridgedContentView because views-style
95 // SetCapture() conflicts with the way tracking events are processed for
96 // the view during a drag. Since the NSWindow is still in the responder chain
97 // overriding cursorUpdate: here handles both cases.
98 if (!NSPointInRect([theEvent locationInWindow], [[self contentView] frame])) {
99 [super cursorUpdate:theEvent];
100 return;
101 }
102
103 NSCursor* cursor = [[self viewsNSWindowDelegate] cursor];
104 if (cursor)
105 [cursor set];
106 else
107 [super cursorUpdate:theEvent];
108 }
109
88 @end 110 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698