| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/glue/webcursor.h" | 5 #include "webkit/glue/webcursor.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 GdkCursor* GetInlineCustomCursor(CustomCursorType type) { | 24 GdkCursor* GetInlineCustomCursor(CustomCursorType type) { |
| 25 static GdkCursor* CustomCursorsGdk[G_N_ELEMENTS(CustomCursors)]; | 25 static GdkCursor* CustomCursorsGdk[G_N_ELEMENTS(CustomCursors)]; |
| 26 GdkCursor* cursor = CustomCursorsGdk[type]; | 26 GdkCursor* cursor = CustomCursorsGdk[type]; |
| 27 if (cursor) | 27 if (cursor) |
| 28 return cursor; | 28 return cursor; |
| 29 const CustomCursor& custom = CustomCursors[type]; | 29 const CustomCursor& custom = CustomCursors[type]; |
| 30 cursor = gdk_cursor_new_from_name(gdk_display_get_default(), custom.name); | 30 cursor = gdk_cursor_new_from_name(gdk_display_get_default(), custom.name); |
| 31 if (!cursor) { | 31 if (!cursor) { |
| 32 const GdkColor fg = { 0, 0, 0, 0 }; | 32 const GdkColor fg = { 0, 0, 0, 0 }; |
| 33 const GdkColor bg = { 65535, 65535, 65535, 65535 }; | 33 const GdkColor bg = { 65535, 65535, 65535, 65535 }; |
| 34 GdkPixmap* source = gdk_bitmap_create_from_data(NULL, custom.bits, | 34 GdkPixmap* source = gdk_bitmap_create_from_data( |
| 35 32, 32); | 35 NULL, reinterpret_cast<const gchar*>(custom.bits), 32, 32); |
| 36 GdkPixmap* mask = gdk_bitmap_create_from_data(NULL, custom.mask_bits, | 36 GdkPixmap* mask = gdk_bitmap_create_from_data( |
| 37 32, 32); | 37 NULL, reinterpret_cast<const gchar*>(custom.mask_bits), 32, 32); |
| 38 cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, | 38 cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, |
| 39 custom.hot_x, custom.hot_y); | 39 custom.hot_x, custom.hot_y); |
| 40 g_object_unref(source); | 40 g_object_unref(source); |
| 41 g_object_unref(mask); | 41 g_object_unref(mask); |
| 42 } | 42 } |
| 43 CustomCursorsGdk[type] = cursor; | 43 CustomCursorsGdk[type] = cursor; |
| 44 return cursor; | 44 return cursor; |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // end anonymous namespace | 47 } // end anonymous namespace |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 unref_ = NULL; | 213 unref_ = NULL; |
| 214 } | 214 } |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void WebCursor::CopyPlatformData(const WebCursor& other) { | 218 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 219 if (other.unref_) | 219 if (other.unref_) |
| 220 unref_ = gdk_cursor_ref(other.unref_); | 220 unref_ = gdk_cursor_ref(other.unref_); |
| 221 return; | 221 return; |
| 222 } | 222 } |
| OLD | NEW |