Changeset 65741 in webkit


Ignore:
Timestamp:
Aug 20, 2010 10:50:05 AM (14 years ago)
Author:
Martin Robinson
Message:

2010-08-20 Martin Robinson <mrobinson@igalia.com>

Reviewed by Xan Lopez.

r64526 broke the GTK+-3 build
https://bugs.webkit.org/show_bug.cgi?id=44254

No new tests, as this is covered by manual-tests/cursor.html.

  • platform/gtk/CursorGtk.cpp: (WebCore::createPixmapFromBits): Added this method which turns the inline data structures into GdkPixmaps using Cairo and GDK-Cairo. (WebCore::createNamedCursor): Modified this method to use the new helper.
  • platform/gtk/CursorGtk.h: Changed all inline data structures to be unsigned char arrays (which Cairo requires). The progress cursor is known in X11 icon themes as "left_ptr_watch." This change to the name preserves the old behavior of taking this icon from the theme when available. It seems that this worked in the past due to a fluke or failure of the previous code.
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65736 r65741  
     12010-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
    1202010-08-20  Martin Robinson  <mrobinson@igalia.com>
    221
  • trunk/WebCore/platform/gtk/CursorGtk.cpp

    r64561 r65741  
    3838namespace WebCore {
    3939
     40static 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
    4053static GRefPtr<GdkCursor> createNamedCursor(CustomCursorType cursorType)
    4154{
     
    4760    const GdkColor fg = { 0, 0, 0, 0 };
    4861    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));
    5165    return adoptGRef(gdk_cursor_new_from_pixmap(source.get(), mask.get(), &fg, &bg, cursor.hot_x, cursor.hot_y));
    5266}
  • trunk/WebCore/platform/gtk/CursorGtk.h

    r43306 r65741  
    4848
    4949/* MOZ_CURSOR_VERTICAL_TEXT */
    50 static const char moz_vertical_text_bits[] = {
     50static const unsigned char moz_vertical_text_bits[] = {
    5151  0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
    5252  0x06, 0x60, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00,
     
    6161  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    6262
    63 static const char moz_vertical_text_mask_bits[] = {
     63static const unsigned char moz_vertical_text_mask_bits[] = {
    6464  0x07, 0xe0, 0x00, 0x00, 0x07, 0xe0, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00,
    6565  0xff, 0xff, 0x00, 0x00, 0xfe, 0x7f, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
     
    7575
    7676/* MOZ_CURSOR_CONTEXT_MENU */
    77 static const char moz_menu_bits[] = {
     77static const unsigned char moz_menu_bits[] = {
    7878  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
    7979  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
     
    8888  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    8989
    90 static const char moz_menu_mask_bits[] = {
     90static const unsigned char moz_menu_mask_bits[] = {
    9191  0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
    9292  0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
     
    102102
    103103/* MOZ_CURSOR_COPY */
    104 static const char moz_copy_bits[] = {
     104static const unsigned char moz_copy_bits[] = {
    105105  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
    106106  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
     
    115115  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    116116
    117 static const char moz_copy_mask_bits[] = {
     117static const unsigned char moz_copy_mask_bits[] = {
    118118  0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
    119119  0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
     
    129129
    130130/* MOZ_CURSOR_ALIAS */
    131 static const char moz_alias_bits[] = {
     131static const unsigned char moz_alias_bits[] = {
    132132  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
    133133  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
     
    142142  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    143143
    144 static const char moz_alias_mask_bits[] = {
     144static const unsigned char moz_alias_mask_bits[] = {
    145145  0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
    146146  0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
     
    156156
    157157/* MOZ_CURSOR_ZOOM_IN */
    158 static const char moz_zoom_in_bits[] = {
     158static const unsigned char moz_zoom_in_bits[] = {
    159159  0xf0, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
    160160  0x62, 0x04, 0x00, 0x00, 0x61, 0x08, 0x00, 0x00, 0xf9, 0x09, 0x00, 0x00,
     
    169169  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    170170
    171 static const char moz_zoom_in_mask_bits[] = {
     171static const unsigned char moz_zoom_in_mask_bits[] = {
    172172  0xf0, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
    173173  0xfe, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
     
    183183
    184184/* MOZ_CURSOR_ZOOM_OUT */
    185 static const char moz_zoom_out_bits[] = {
     185static const unsigned char moz_zoom_out_bits[] = {
    186186  0xf0, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
    187187  0x02, 0x04, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0xf9, 0x09, 0x00, 0x00,
     
    196196  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    197197
    198 static const char moz_zoom_out_mask_bits[] = {
     198static const unsigned char moz_zoom_out_mask_bits[] = {
    199199  0xf0, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x00, 0xfe, 0x07, 0x00, 0x00,
    200200  0xfe, 0x07, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00,
     
    210210
    211211/* MOZ_CURSOR_NOT_ALLOWED */
    212 static const char moz_not_allowed_bits[] = {
     212static const unsigned char moz_not_allowed_bits[] = {
    213213  0x00, 0x00, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00,
    214214  0xf0, 0xf0, 0x00, 0x00, 0x38, 0xc0, 0x01, 0x00, 0x7c, 0x80, 0x03, 0x00,
     
    223223  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    224224
    225 static const char moz_not_allowed_mask_bits[] = {
     225static const unsigned char moz_not_allowed_mask_bits[] = {
    226226  0x80, 0x1f, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00,
    227227  0xf8, 0xff, 0x01, 0x00, 0xfc, 0xf0, 0x03, 0x00, 0xfe, 0xc0, 0x07, 0x00,
     
    237237
    238238/* MOZ_CURSOR_SPINNING */
    239 static const char moz_spinning_bits[] = {
     239static const unsigned char moz_spinning_bits[] = {
    240240  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
    241241  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
     
    250250  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    251251
    252 static const char moz_spinning_mask_bits[] = {
     252static const unsigned char moz_spinning_mask_bits[] = {
    253253  0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
    254254  0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
     
    264264
    265265/* 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[] = {
     266static 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
     279static const unsigned char moz_none_mask_bits[] = {
    280280  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    281281  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     
    291291
    292292/* MOZ_CURSOR_HAND_GRAB */
    293 static const char moz_hand_grab_bits[] = {
     293static const unsigned char moz_hand_grab_bits[] = {
    294294  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
    295295  0x60, 0x39, 0x00, 0x00, 0x90, 0x49, 0x00, 0x00, 0x90, 0x49, 0x01, 0x00,
     
    304304  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    305305
    306 static const char moz_hand_grab_mask_bits[] = {
     306static const unsigned char moz_hand_grab_mask_bits[] = {
    307307  0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x60, 0x3f, 0x00, 0x00,
    308308  0xf0, 0x7f, 0x00, 0x00, 0xf8, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x03, 0x00,
     
    318318
    319319/* MOZ_CURSOR_HAND_GRABBING */
    320 static const char moz_hand_grabbing_bits[] = {
     320static const unsigned char moz_hand_grabbing_bits[] = {
    321321  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    322322  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     
    331331  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
    332332
    333 static const  char moz_hand_grabbing_mask_bits[] = {
     333static const  unsigned char moz_hand_grabbing_mask_bits[] = {
    334334  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    335335  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x36, 0x00, 0x00,
     
    360360typedef struct {
    361361    const char* name;
    362     const char* bits;
    363     const char* mask_bits;
     362    const unsigned char* bits;
     363    const unsigned char* mask_bits;
    364364    int hot_x;
    365365    int hot_y;
     
    375375    { "vertical-text", moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4 },
    376376    { "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},
    378378    { "none", moz_none_bits, moz_none_mask_bits, 0, 0 },
    379379    { "grab", moz_hand_grab_bits, moz_hand_grab_mask_bits, 10, 10 },
Note: See TracChangeset for help on using the changeset viewer.