diff options
author | Jasmine Hassan <[email protected]> | 2012-10-18 13:22:16 +0200 |
---|---|---|
committer | Jasmine Hassan <[email protected]> | 2012-11-13 06:25:03 +0200 |
commit | 92ff8b1860812a2cb58bfb492765b109411d8fd5 (patch) | |
tree | e52bbe5b51479ee3119d74c374717e5d2757e7f3 /eel | |
parent | 0fdc303dd11b419465d299b36307010ce3221cfa (diff) | |
download | caja-92ff8b1860812a2cb58bfb492765b109411d8fd5.tar.bz2 caja-92ff8b1860812a2cb58bfb492765b109411d8fd5.tar.xz |
[eel] port eel-gdk-extensions to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=917a27a6f69509720fadd0d50e40dbc87ae9f5d2
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-gdk-extensions.c | 92 | ||||
-rw-r--r-- | eel/eel-gdk-extensions.h | 5 |
2 files changed, 14 insertions, 83 deletions
diff --git a/eel/eel-gdk-extensions.c b/eel/eel-gdk-extensions.c index 86a8600e..ab3972ef 100644 --- a/eel/eel-gdk-extensions.c +++ b/eel/eel-gdk-extensions.c @@ -539,59 +539,6 @@ eel_gdk_color_is_dark (GdkColor *color) } /** - * eel_stipple_bitmap_for_screen: - * - * Get pointer to 50% stippled bitmap suitable for use - * on @screen. This is a global object; do not free. - */ -GdkBitmap * -eel_stipple_bitmap_for_screen (GdkScreen *screen) -{ - static char stipple_bits[] = { 0x02, 0x01 }; - static GPtrArray *stipples = NULL; - int screen_num, n_screens, i; - - if (stipples == NULL) - { - n_screens = gdk_display_get_n_screens ( - gdk_screen_get_display (screen)); - stipples = g_ptr_array_sized_new (n_screens); - - for (i = 0; i < n_screens; i++) - { - g_ptr_array_index (stipples, i) = NULL; - } - } - - screen_num = gdk_screen_get_number (screen); - - if (g_ptr_array_index (stipples, screen_num) == NULL) - { - g_ptr_array_index (stipples, screen_num) = - gdk_bitmap_create_from_data ( - gdk_screen_get_root_window (screen), - stipple_bits, 2, 2); - } - - return g_ptr_array_index (stipples, screen_num); -} - -/** - * eel_stipple_bitmap: - * - * Get pointer to 50% stippled bitmap suitable for use - * on the default screen. This is a global object; do - * not free. - * - * This method is not multiscreen safe. Do not use it. - */ -GdkBitmap * -eel_stipple_bitmap (void) -{ - return eel_stipple_bitmap_for_screen (gdk_screen_get_default ()); -} - -/** * eel_gdk_window_bring_to_front: * * Raise window and give it focus. @@ -677,28 +624,14 @@ eel_gdk_window_set_wm_hints_input (GdkWindow *window, gboolean status) void eel_gdk_window_set_invisible_cursor (GdkWindow *window) { - GdkBitmap *empty_bitmap; GdkCursor *cursor; - GdkColor useless; - char invisible_cursor_bits[] = { 0x0 }; - - useless.red = useless.green = useless.blue = 0; - useless.pixel = 0; - empty_bitmap = gdk_bitmap_create_from_data (window, - invisible_cursor_bits, - 1, 1); - - cursor = gdk_cursor_new_from_pixmap (empty_bitmap, - empty_bitmap, - &useless, - &useless, 0, 0); + cursor = gdk_cursor_new_for_display (gdk_drawable_get_display (window), + GDK_BLANK_CURSOR); gdk_window_set_cursor (window, cursor); gdk_cursor_unref (cursor); - - g_object_unref (empty_bitmap); } EelGdkGeometryFlags @@ -748,22 +681,25 @@ eel_gdk_parse_geometry (const char *string, int *x_return, int *y_return, void eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable, - GdkGC *gc, GdkColor *text_color, GdkColor *shadow_color, int x, int y, PangoLayout *layout) { - gdk_draw_layout_with_colors (drawable, gc, - x+1, y+1, - layout, - shadow_color, NULL); + cairo_t *cr; + + cr = gdk_cairo_create (drawable); + + gdk_cairo_set_source_color (cr, shadow_color); + cairo_move_to (cr, x+1, y+1); + pango_cairo_show_layout (cr, layout); + + gdk_cairo_set_source_color (cr, text_color); + cairo_move_to (cr, x, y); + pango_cairo_show_layout (cr, layout); - gdk_draw_layout_with_colors (drawable, gc, - x, y, - layout, - text_color, NULL); + cairo_destroy (cr); } #if ! defined (EEL_OMIT_SELF_CHECK) diff --git a/eel/eel-gdk-extensions.h b/eel/eel-gdk-extensions.h index 91518186..69f29e62 100644 --- a/eel/eel-gdk-extensions.h +++ b/eel/eel-gdk-extensions.h @@ -120,10 +120,6 @@ char * eel_gdk_rgb_to_color_spec (guint32 gboolean eel_gdk_color_is_dark (GdkColor *color); -/* A routine to get a 50% gray stippled bitmap for use in some types of highlighting. */ -GdkBitmap * eel_stipple_bitmap_for_screen (GdkScreen *screen); -GdkBitmap * eel_stipple_bitmap (void); - /* Misc GdkRectangle helper functions */ gboolean eel_gdk_rectangle_contains_rectangle (GdkRectangle outer, @@ -155,7 +151,6 @@ EelGdkGeometryFlags eel_gdk_parse_geometry (const char guint *width_return, guint *height_return); void eel_gdk_draw_layout_with_drop_shadow (GdkDrawable *drawable, - GdkGC *gc, GdkColor *text_color, GdkColor *shadow_color, int x, |