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

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: cl format Created 5 years, 11 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
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 9a6fa2ef8f4cd543b28a267046a9659a5db65e21..3e68fc620a701a5a011613fe7d2c9995d9c09655 100644
--- a/ui/views/cocoa/native_widget_mac_nswindow.mm
+++ b/ui/views/cocoa/native_widget_mac_nswindow.mm
@@ -85,4 +85,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

Powered by Google App Engine
This is Rietveld 408576698