From 6ee524b8b8f376b02f598e6ba44813c6386e0692 Mon Sep 17 00:00:00 2001 From: "avi@chromium.org" Date: Tue, 10 Feb 2009 22:35:30 +0000 Subject: Turn on Mac cursor support now that we're already linking in the world. Review URL: http://codereview.chromium.org/21227 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9522 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_host/render_widget_host_view_mac.h | 3 ++- .../renderer_host/render_widget_host_view_mac.mm | 24 +++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'chrome/browser/renderer_host') diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.h b/chrome/browser/renderer_host/render_widget_host_view_mac.h index 1ca398c..398c411 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.h +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.h @@ -9,6 +9,7 @@ #include "base/time.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" +#include "webkit/glue/webcursor.h" class RenderWidgetHostViewMac; @@ -92,7 +93,7 @@ class RenderWidgetHostViewMac : public RenderWidgetHostView { RenderWidgetHost* render_widget_host_; // The cursor for the page. This is passed up from the renderer. -// WebCursor current_cursor_; // temporarily commented for link issues + WebCursor current_cursor_; // Indicates if the page is loading. bool is_loading_; diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm index dfb290e..dd2066a 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm +++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm @@ -124,17 +124,27 @@ gfx::Rect RenderWidgetHostViewMac::GetViewBounds() const { } 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) { -- cgit v1.1