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

Unified 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: assign -> retain 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/native_widget_mac_nswindow.mm
diff --git a/ui/views/cocoa/native_widget_mac_nswindow.mm b/ui/views/cocoa/native_widget_mac_nswindow.mm
index 7a3d3dcb931c95767957dc5fc4541fb579ecbfcb..e8c3c8b45de5aa4cd5e396d2e5af687770134c8b 100644
--- a/ui/views/cocoa/native_widget_mac_nswindow.mm
+++ b/ui/views/cocoa/native_widget_mac_nswindow.mm
@@ -59,4 +59,26 @@
[[self viewsNSWindowDelegate] onWindowOrderChanged:nil];
}
+// NSResponder implementation.
+
+- (void)cursorUpdate:(NSEvent*)theEvent {
+ // The cursor provided by the delegate should only be applied within the
+ // content area. This is because we rely on the contentView to track the
+ // mouse cursor and forward cursorUpdate: messages up the responder chain.
+ // The cursorUpdate: isn't handled in BridgedContentView because views-style
+ // SetCapture() conflicts with the way tracking events are processed for
+ // the view during a drag. Since the NSWindow is still in the responder chain
+ // overriding cursorUpdate: here handles both cases.
+ if (!NSPointInRect([theEvent locationInWindow], [[self contentView] frame])) {
+ [super cursorUpdate:theEvent];
+ return;
+ }
+
+ NSCursor* cursor = [[self viewsNSWindowDelegate] cursor];
+ if (cursor)
+ [cursor set];
+ else
+ [super cursorUpdate:theEvent];
+}
+
@end
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698