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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 21227: Turn on Mac cursor support now that we're already linking in the world. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 9502)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -124,17 +124,27 @@
}
void RenderWidgetHostViewMac::UpdateCursor(const WebCursor& cursor) {
-// current_cursor_ = cursor; // temporarily commented for link issues
+ current_cursor_ = cursor;
UpdateCursorIfOverSelf();
}
void RenderWidgetHostViewMac::UpdateCursorIfOverSelf() {
- // Do something special (as Windows does) for arrow cursor while loading a
- // page? TODO(avi): decide
- // TODO(avi): check to see if mouse pointer is within our bounds
- // Disabled so we don't have to link in glue... yet
-// NSCursor* ns_cursor = current_cursor_.GetCursor();
-// [ns_cursor set];
+ // Do something special (as Win Chromium does) for arrow cursor while loading
+ // a page? TODO(avi): decide
+ // Can we synchronize to the event stream? Switch to -[NSWindow
+ // mouseLocationOutsideOfEventStream] if we cannot. TODO(avi): test and see
+ NSEvent* event = [[cocoa_view_ window] currentEvent];
+ if ([event window] != [cocoa_view_ window])
+ return;
+
+ NSPoint event_location = [event locationInWindow];
+ NSPoint local_point = [cocoa_view_ convertPoint:event_location fromView:nil];
+
+ if (!NSPointInRect(local_point, [cocoa_view_ bounds]))
+ return;
+
+ NSCursor* ns_cursor = current_cursor_.GetCursor();
+ [ns_cursor set];
}
void RenderWidgetHostViewMac::SetIsLoading(bool is_loading) {
« no previous file with comments | « chrome/browser/renderer_host/render_widget_host_view_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698