diff options
author | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 18:45:26 +0000 |
---|---|---|
committer | evanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 18:45:26 +0000 |
commit | 2b99be2e12968b5d3d4f5818d6a76a8d42d818bc (patch) | |
tree | 89d180b90aa94bed3fa0d887bbf44e229b164cdf /webkit/glue/webcursor_gtk.cc | |
parent | 03f95811129d967c67942cbc8fd20572476c95d7 (diff) | |
download | chromium_src-2b99be2e12968b5d3d4f5818d6a76a8d42d818bc.zip chromium_src-2b99be2e12968b5d3d4f5818d6a76a8d42d818bc.tar.gz chromium_src-2b99be2e12968b5d3d4f5818d6a76a8d42d818bc.tar.bz2 |
Custom cursor support.
This is necessary for Google Maps, and also cuts out another NOTIMPLEMENTED().
Review URL: http://codereview.chromium.org/10734
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webcursor_gtk.cc')
-rw-r--r-- | webkit/glue/webcursor_gtk.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/webkit/glue/webcursor_gtk.cc b/webkit/glue/webcursor_gtk.cc index 6224804..6607d67 100644 --- a/webkit/glue/webcursor_gtk.cc +++ b/webkit/glue/webcursor_gtk.cc @@ -4,6 +4,8 @@ #include "webkit/glue/webcursor.h" +#include <gdk/gdk.h> + #include "config.h" #include "PlatformCursor.h" @@ -105,3 +107,26 @@ GdkCursorType WebCursor::GetCursorType() const { NOTREACHED(); return GDK_ARROW; } + +GdkCursor* WebCursor::GetCustomCursor() const { + const guchar* data = reinterpret_cast<const guchar*>(&custom_data_[0]); + GdkPixbuf* pixbuf = + gdk_pixbuf_new_from_data(data, + GDK_COLORSPACE_RGB, + TRUE, // has_alpha + 8, // bits_per_sample + custom_size_.width(), // width + custom_size_.height(), // height + custom_size_.width() * 4, // row stride + NULL, // data destroy function + NULL); // data destroy function extra data + + GdkCursor* cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), + pixbuf, + hotspot_.x(), + hotspot_.y()); + + gdk_pixbuf_unref(pixbuf); + + return cursor; +} |