| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 case WebCursorInfo::TypeGrab: | 134 case WebCursorInfo::TypeGrab: |
| 135 case WebCursorInfo::TypeGrabbing: | 135 case WebCursorInfo::TypeGrabbing: |
| 136 case WebCursorInfo::TypeCustom: | 136 case WebCursorInfo::TypeCustom: |
| 137 return GDK_CURSOR_IS_PIXMAP; | 137 return GDK_CURSOR_IS_PIXMAP; |
| 138 } | 138 } |
| 139 NOTREACHED(); | 139 NOTREACHED(); |
| 140 return GDK_LAST_CURSOR; | 140 return GDK_LAST_CURSOR; |
| 141 } | 141 } |
| 142 | 142 |
| 143 gfx::NativeCursor WebCursor::GetNativeCursor() { | 143 gfx::NativeCursor WebCursor::GetNativeCursor() { |
| 144 #if defined(USE_AURA) |
| 145 // TODO(saintlou): |
| 146 return NULL; |
| 147 #else |
| 144 int type = GetCursorType(); | 148 int type = GetCursorType(); |
| 145 if (type == GDK_CURSOR_IS_PIXMAP) | 149 if (type == GDK_CURSOR_IS_PIXMAP) |
| 146 return GetCustomCursor(); | 150 return GetCustomCursor(); |
| 147 return gfx::GetCursor(type); | 151 return gfx::GetCursor(type); |
| 152 #endif |
| 148 } | 153 } |
| 149 | 154 |
| 150 GdkCursor* WebCursor::GetCustomCursor() { | 155 GdkCursor* WebCursor::GetCustomCursor() { |
| 156 #if defined(USE_AURA) |
| 157 // TODO(saintlou): |
| 158 return NULL; |
| 159 #else |
| 151 switch (type_) { | 160 switch (type_) { |
| 152 case WebCursorInfo::TypeZoomIn: | 161 case WebCursorInfo::TypeZoomIn: |
| 153 return GetInlineCustomCursor(CustomCursorZoomIn); | 162 return GetInlineCustomCursor(CustomCursorZoomIn); |
| 154 case WebCursorInfo::TypeZoomOut: | 163 case WebCursorInfo::TypeZoomOut: |
| 155 return GetInlineCustomCursor(CustomCursorZoomOut); | 164 return GetInlineCustomCursor(CustomCursorZoomOut); |
| 156 case WebCursorInfo::TypeGrab: | 165 case WebCursorInfo::TypeGrab: |
| 157 return GetInlineCustomCursor(CustomCursorGrab); | 166 return GetInlineCustomCursor(CustomCursorGrab); |
| 158 case WebCursorInfo::TypeGrabbing: | 167 case WebCursorInfo::TypeGrabbing: |
| 159 return GetInlineCustomCursor(CustomCursorGrabbing); | 168 return GetInlineCustomCursor(CustomCursorGrabbing); |
| 160 } | 169 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 175 pixbuf, | 184 pixbuf, |
| 176 hotspot_.x(), | 185 hotspot_.x(), |
| 177 hotspot_.y()); | 186 hotspot_.y()); |
| 178 | 187 |
| 179 gdk_pixbuf_unref(pixbuf); | 188 gdk_pixbuf_unref(pixbuf); |
| 180 | 189 |
| 181 if (unref_) | 190 if (unref_) |
| 182 gdk_cursor_unref(unref_); | 191 gdk_cursor_unref(unref_); |
| 183 unref_ = cursor; | 192 unref_ = cursor; |
| 184 return cursor; | 193 return cursor; |
| 194 #endif |
| 185 } | 195 } |
| 186 | 196 |
| 187 void WebCursor::InitPlatformData() { | 197 void WebCursor::InitPlatformData() { |
| 188 unref_ = NULL; | 198 unref_ = NULL; |
| 189 return; | 199 return; |
| 190 } | 200 } |
| 191 | 201 |
| 192 bool WebCursor::SerializePlatformData(Pickle* pickle) const { | 202 bool WebCursor::SerializePlatformData(Pickle* pickle) const { |
| 193 return true; | 203 return true; |
| 194 } | 204 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 207 unref_ = NULL; | 217 unref_ = NULL; |
| 208 } | 218 } |
| 209 return; | 219 return; |
| 210 } | 220 } |
| 211 | 221 |
| 212 void WebCursor::CopyPlatformData(const WebCursor& other) { | 222 void WebCursor::CopyPlatformData(const WebCursor& other) { |
| 213 if (other.unref_) | 223 if (other.unref_) |
| 214 unref_ = gdk_cursor_ref(other.unref_); | 224 unref_ = gdk_cursor_ref(other.unref_); |
| 215 return; | 225 return; |
| 216 } | 226 } |
| OLD | NEW |