зеркало из https://github.com/mozilla/gecko-dev.git
Bug 709259 - Try creating a named cursor before a bitmap cursor. r=karlt
--HG-- extra : rebase_source : fa486f1dae4c162a4a21212ba697e5762e7d0e4b
This commit is contained in:
Родитель
5bed6cd06f
Коммит
aac3a9f0ba
|
@ -46,6 +46,7 @@ typedef struct {
|
|||
const unsigned char *mask_bits;
|
||||
int hot_x;
|
||||
int hot_y;
|
||||
const char *hash;
|
||||
} nsGtkCursor;
|
||||
|
||||
/* MOZ_CURSOR_HAND_GRAB */
|
||||
|
@ -415,21 +416,23 @@ enum {
|
|||
MOZ_CURSOR_NONE
|
||||
};
|
||||
|
||||
// create custom pixmap cursor
|
||||
// create custom pixmap cursor. The hash values must stay in sync with the
|
||||
// bitmap data above. To see the hash function, have a look at XcursorImageHash
|
||||
// in libXcursor
|
||||
static const nsGtkCursor GtkCursors[] = {
|
||||
{ moz_hand_grab_bits, moz_hand_grab_mask_bits, 10, 10 },
|
||||
{ moz_hand_grabbing_bits, moz_hand_grabbing_mask_bits, 10, 10 },
|
||||
{ moz_copy_bits, moz_copy_mask_bits, 2, 2 },
|
||||
{ moz_alias_bits, moz_alias_mask_bits, 2, 2 },
|
||||
{ moz_menu_bits, moz_menu_mask_bits, 2, 2 },
|
||||
{ moz_spinning_bits, moz_spinning_mask_bits, 2, 2 },
|
||||
{ moz_zoom_in_bits, moz_zoom_in_mask_bits, 6, 6 },
|
||||
{ moz_zoom_out_bits, moz_zoom_out_mask_bits, 6, 6 },
|
||||
{ moz_not_allowed_bits, moz_not_allowed_mask_bits, 9, 9 },
|
||||
{ moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4 },
|
||||
{ moz_nesw_resize_bits, moz_nesw_resize_mask_bits, 8, 8 },
|
||||
{ moz_nwse_resize_bits, moz_nwse_resize_mask_bits, 8, 8 },
|
||||
{ moz_none_bits, moz_none_mask_bits, 0, 0 }
|
||||
{ moz_hand_grab_bits, moz_hand_grab_mask_bits, 10, 10, "5aca4d189052212118709018842178c0" },
|
||||
{ moz_hand_grabbing_bits, moz_hand_grabbing_mask_bits, 10, 10, "208530c400c041818281048008011002" },
|
||||
{ moz_copy_bits, moz_copy_mask_bits, 2, 2, "08ffe1cb5fe6fc01f906f1c063814ccf" },
|
||||
{ moz_alias_bits, moz_alias_mask_bits, 2, 2, "0876e1c15ff2fc01f906f1c363074c0f" },
|
||||
{ moz_menu_bits, moz_menu_mask_bits, 2, 2, "08ffe1e65f80fcfdf9fff11263e74c48" },
|
||||
{ moz_spinning_bits, moz_spinning_mask_bits, 2, 2, "08e8e1c95fe2fc01f976f1e063a24ccd" },
|
||||
{ moz_zoom_in_bits, moz_zoom_in_mask_bits, 6, 6, "f41c0e382c94c0958e07017e42b00462" },
|
||||
{ moz_zoom_out_bits, moz_zoom_out_mask_bits, 6, 6, "f41c0e382c97c0938e07017e42800402" },
|
||||
{ moz_not_allowed_bits, moz_not_allowed_mask_bits, 9, 9, "03b6e0fcb3499374a867d041f52298f0" },
|
||||
{ moz_vertical_text_bits, moz_vertical_text_mask_bits, 8, 4, "048008013003cff3c00c801001200000" },
|
||||
{ moz_nesw_resize_bits, moz_nesw_resize_mask_bits, 8, 8, "50585d75b494802d0151028115016902" },
|
||||
{ moz_nwse_resize_bits, moz_nwse_resize_mask_bits, 8, 8, "38c5dff7c7b8962045400281044508d2" },
|
||||
{ moz_none_bits, moz_none_mask_bits, 0, 0, NULL }
|
||||
};
|
||||
|
||||
#endif /* nsGtkCursors_h__ */
|
||||
|
|
|
@ -5645,9 +5645,17 @@ get_gtk_cursor(nsCursor aCursor)
|
|||
break;
|
||||
}
|
||||
|
||||
// if by now we don't have a xcursor, this means we have to make a
|
||||
// custom one
|
||||
if (newType != 0xff) {
|
||||
// If by now we don't have a xcursor, this means we have to make a custom
|
||||
// one. First, we try creating a named cursor based on the hash of our
|
||||
// custom bitmap, as libXcursor has some magic to convert bitmapped cursors
|
||||
// to themed cursors
|
||||
if (newType != 0xFF && GtkCursors[newType].hash) {
|
||||
gdkcursor = gdk_cursor_new_from_name(gdk_display_get_default(),
|
||||
GtkCursors[newType].hash);
|
||||
}
|
||||
|
||||
// If we still don't have a xcursor, we now really create a bitmap cursor
|
||||
if (newType != 0xff && !gdkcursor) {
|
||||
GdkPixbuf * cursor_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
|
||||
if (!cursor_pixbuf)
|
||||
return NULL;
|
||||
|
|
Загрузка…
Ссылка в новой задаче