diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 20:25:14 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-13 20:25:14 +0000 |
commit | 1667c9ee6ca5eaad3751f4dca355bc24ffd2d3c9 (patch) | |
tree | dc00bb6a0eae4aca18bfddb9d15c3bad5ba4667d /chrome/browser | |
parent | af2abee798d1ba9f60096e691e0215218a671043 (diff) | |
download | chromium_src-1667c9ee6ca5eaad3751f4dca355bc24ffd2d3c9.zip chromium_src-1667c9ee6ca5eaad3751f4dca355bc24ffd2d3c9.tar.gz chromium_src-1667c9ee6ca5eaad3751f4dca355bc24ffd2d3c9.tar.bz2 |
Hook up browser cursors on linux.
Review URL: http://codereview.chromium.org/21358
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
3 files changed, 26 insertions, 2 deletions
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 204b54f..b24014c 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -192,7 +192,28 @@ gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { } void RenderWidgetHostViewGtk::UpdateCursor(const WebCursor& cursor) { - NOTIMPLEMENTED(); + // TODO(port): some of this logic may need moving to UpdateCursorIfOverSelf at + // some point. + GdkCursorType current_cursor_type = current_cursor_.GetCursorType(); + GdkCursorType new_cursor_type = cursor.GetCursorType(); + current_cursor_ = cursor; + GdkCursor* gdk_cursor; + if (new_cursor_type == GDK_CURSOR_IS_PIXMAP) { + // TODO(port): WebKit bug https://bugs.webkit.org/show_bug.cgi?id=16388 is + // that calling gdk_window_set_cursor repeatedly is expensive. We should + // avoid it here where possible. + gdk_cursor = current_cursor_.GetCustomCursor(); + } else { + // Optimize the common case, where the cursor hasn't changed. + // However, we can switch between different pixmaps, so only on the + // non-pixmap branch. + if (new_cursor_type == current_cursor_type) + return; + gdk_cursor = gdk_cursor_new(new_cursor_type); + } + gdk_window_set_cursor(view_->window, gdk_cursor); + // The window now owns the cursor. + gdk_cursor_unref(gdk_cursor); } void RenderWidgetHostViewGtk::UpdateCursorIfOverSelf() { diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h index 8ba93a0..d839f06 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h @@ -9,6 +9,7 @@ #include "base/gfx/native_widget_types.h" #include "chrome/browser/renderer_host/render_widget_host_view.h" +#include "webkit/glue/webcursor.h" class RenderWidgetHost; @@ -57,6 +58,9 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView { RenderWidgetHost *const host_; // The native UI widget. gfx::NativeView view_; + + // The cursor for the page. This is passed up from the renderer. + WebCursor current_cursor_; }; #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.h b/chrome/browser/renderer_host/render_widget_host_view_win.h index 167f529..ff80c83 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_win.h +++ b/chrome/browser/renderer_host/render_widget_host_view_win.h @@ -27,7 +27,6 @@ class Message; } class RenderWidgetHost; class WebMouseEvent; -class WebCursor; typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> RenderWidgetHostHWNDTraits; |