Changeset 65741 in webkit
- Timestamp:
- Aug 20, 2010 10:50:05 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65736 r65741 1 2010-08-20 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Xan Lopez. 4 5 r64526 broke the GTK+-3 build 6 https://bugs.webkit.org/show_bug.cgi?id=44254 7 8 No new tests, as this is covered by manual-tests/cursor.html. 9 10 * platform/gtk/CursorGtk.cpp: 11 (WebCore::createPixmapFromBits): Added this method which turns the inline data 12 structures into GdkPixmaps using Cairo and GDK-Cairo. 13 (WebCore::createNamedCursor): Modified this method to use the new helper. 14 * platform/gtk/CursorGtk.h: Changed all inline data structures to be unsigned 15 char arrays (which Cairo requires). The progress cursor is known in X11 icon themes 16 as "left_ptr_watch." This change to the name preserves the old behavior of taking this 17 icon from the theme when available. It seems that this worked in the past due to a fluke 18 or failure of the previous code. 19 1 20 2010-08-20 Martin Robinson <mrobinson@igalia.com> 2 21 -
trunk/WebCore/platform/gtk/CursorGtk.cpp
r64561 r65741 38 38 namespace WebCore { 39 39 40 static GdkPixmap* createPixmapFromBits(const unsigned char* bits, const IntSize& size) 41 { 42 cairo_surface_t* dataSurface = cairo_image_surface_create_for_data(const_cast<unsigned char*>(bits), CAIRO_FORMAT_A1, size.width(), size.height(), size.width() / 8); 43 GdkPixmap* pixmap = gdk_pixmap_new(0, size.width(), size.height(), 1); 44 cairo_t* cr = gdk_cairo_create(pixmap); 45 cairo_set_source_surface(cr, dataSurface, 0, 0); 46 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); 47 cairo_paint(cr); 48 cairo_destroy(cr); 49 cairo_surface_destroy(dataSurface); 50 return pixmap; 51 } 52 40 53 static GRefPtr<GdkCursor> createNamedCursor(CustomCursorType cursorType) 41 54 { … … 47 60 const GdkColor fg = { 0, 0, 0, 0 }; 48 61 const GdkColor bg = { 65535, 65535, 65535, 65535 }; 49 GRefPtr<GdkPixmap> source = adoptGRef(gdk_bitmap_create_from_data(0, cursor.bits, 32, 32)); 50 GRefPtr<GdkPixmap> mask = adoptGRef(gdk_bitmap_create_from_data(0, cursor.mask_bits, 32, 32)); 62 IntSize cursorSize = IntSize(32, 32); 63 GRefPtr<GdkPixmap> source = adoptGRef(createPixmapFromBits(cursor.bits, cursorSize)); 64 GRefPtr<GdkPixmap> mask = adoptGRef(createPixmapFromBits(cursor.mask_bits, cursorSize)); 51 65 return adoptGRef(gdk_cursor_new_from_pixmap(source.get(), mask.get(), &fg, &bg, cursor.hot_x, cursor.hot_y)); 52 66 } -
trunk/WebCore/platform/gtk/CursorGtk.h
r43306 r65741 48 48 49 49 /* MOZ_CURSOR_VERTICAL_TEXT */ 50 static const char moz_vertical_text_bits[] = {50 static const unsigned char moz_vertical_text_bits[] = { 51 51 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 52 52 0x06, 0x60, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, … … 61 61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 62 62 63 static const char moz_vertical_text_mask_bits[] = {63 static const unsigned char moz_vertical_text_mask_bits[] = { 64 64 0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 65 65 0xff, 0xff, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, … … 75 75 76 76 /* MOZ_CURSOR_CONTEXT_MENU */ 77 static const char moz_menu_bits[] = {77 static const unsigned char moz_menu_bits[] = { 78 78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 79 79 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, … … 88 88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 89 89 90 static const char moz_menu_mask_bits[] = {90 static const unsigned char moz_menu_mask_bits[] = { 91 91 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 92 92 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, … … 102 102 103 103 /* MOZ_CURSOR_COPY */ 104 static const char moz_copy_bits[] = {104 static const unsigned char moz_copy_bits[] = { 105 105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 106 106 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, … … 115 115 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 116 116 117 static const char moz_copy_mask_bits[] = {117 static const unsigned char moz_copy_mask_bits[] = { 118 118 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 119 119 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, … … 129 129 130 130 /* MOZ_CURSOR_ALIAS */ 131 static const char moz_alias_bits[] = {131 static const unsigned char moz_alias_bits[] = { 132 132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 133 133 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, … … 142 142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 143 143 144 static const char moz_alias_mask_bits[] = {144 static const unsigned char moz_alias_mask_bits[] = { 145 145 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 146 146 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, … … 156 156 157 157 /* MOZ_CURSOR_ZOOM_IN */ 158 static const char moz_zoom_in_bits[] = {158 static const unsigned char moz_zoom_in_bits[] = { 159 159 0xf0, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 160 160 0x62, 0x04, 0x00, 0x00, 0x61, 0x08, 0x00, 0x00, 0xf9, 0x09, 0x00, 0x00, … … 169 169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 170 170 171 static const char moz_zoom_in_mask_bits[] = {171 static const unsigned char moz_zoom_in_mask_bits[] = { 172 172 0xf0, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 173 173 0xfe, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, … … 183 183 184 184 /* MOZ_CURSOR_ZOOM_OUT */ 185 static const char moz_zoom_out_bits[] = {185 static const unsigned char moz_zoom_out_bits[] = { 186 186 0xf0, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 187 187 0x02, 0x04, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf9, 0x09, 0x00, 0x00, … … 196 196 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 197 197 198 static const char moz_zoom_out_mask_bits[] = {198 static const unsigned char moz_zoom_out_mask_bits[] = { 199 199 0xf0, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00, 200 200 0xfe, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, … … 210 210 211 211 /* MOZ_CURSOR_NOT_ALLOWED */ 212 static const char moz_not_allowed_bits[] = {212 static const unsigned char moz_not_allowed_bits[] = { 213 213 0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 214 214 0xf0, 0xf0, 0x00, 0x00, 0x38, 0xc0, 0x01, 0x00, 0x7c, 0x80, 0x03, 0x00, … … 223 223 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 224 224 225 static const char moz_not_allowed_mask_bits[] = {225 static const unsigned char moz_not_allowed_mask_bits[] = { 226 226 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 227 227 0xf8, 0xff, 0x01, 0x00, 0xfc, 0xf0, 0x03, 0x00, 0xfe, 0xc0, 0x07, 0x00, … … 237 237 238 238 /* MOZ_CURSOR_SPINNING */ 239 static const char moz_spinning_bits[] = {239 static const unsigned char moz_spinning_bits[] = { 240 240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 241 241 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, … … 250 250 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 251 251 252 static const char moz_spinning_mask_bits[] = {252 static const unsigned char moz_spinning_mask_bits[] = { 253 253 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 254 254 0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, … … 264 264 265 265 /* MOZ_CURSOR_NONE */ 266 static const char moz_none_bits[] = {267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 278 279 static const char moz_none_mask_bits[] = {266 static const unsigned char moz_none_bits[] = { 267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 268 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 269 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 270 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 271 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 272 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 274 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 275 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 276 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 277 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 278 279 static const unsigned char moz_none_mask_bits[] = { 280 280 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 281 281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, … … 291 291 292 292 /* MOZ_CURSOR_HAND_GRAB */ 293 static const char moz_hand_grab_bits[] = {293 static const unsigned char moz_hand_grab_bits[] = { 294 294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 295 295 0x60, 0x39, 0x00, 0x00, 0x90, 0x49, 0x00, 0x00, 0x90, 0x49, 0x01, 0x00, … … 304 304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 305 305 306 static const char moz_hand_grab_mask_bits[] = {306 static const unsigned char moz_hand_grab_mask_bits[] = { 307 307 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00, 308 308 0xf0, 0x7f, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x03, 0x00, … … 318 318 319 319 /* MOZ_CURSOR_HAND_GRABBING */ 320 static const char moz_hand_grabbing_bits[] = {320 static const unsigned char moz_hand_grabbing_bits[] = { 321 321 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 322 322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, … … 331 331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 332 332 333 static const char moz_hand_grabbing_mask_bits[] = {333 static const unsigned char moz_hand_grabbing_mask_bits[] = { 334 334 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 335 335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x36, 0x00, 0x00, … … 360 360 typedef struct { 361 361 const char* name; 362 const char* bits;363 const char* mask_bits;362 const unsigned char* bits; 363 const unsigned char* mask_bits; 364 364 int hot_x; 365 365 int hot_y; … … 375 375 { "vertical-text", moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4 }, 376 376 { "dnd-no-drop", moz_not_allowed_bits, moz_not_allowed_mask_bits, 9, 9 }, 377 { " progress", moz_spinning_bits, moz_spinning_mask_bits, 2, 2},377 { "left_ptr_watch", moz_spinning_bits, moz_spinning_mask_bits, 2, 2}, 378 378 { "none", moz_none_bits, moz_none_mask_bits, 0, 0 }, 379 379 { "grab", moz_hand_grab_bits, moz_hand_grab_mask_bits, 10, 10 },
Note: See TracChangeset
for help on using the changeset viewer.