eelを改造してNautilusデスクトップを見やすくする

libeel:eel-gdk-extensions.c の eel_gdk_draw_layout_with_drop_shadow() がデスクトップアイコンのラベル描画に使われている。

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);
	
	gdk_draw_layout_with_colors (drawable, gc,
				     x, y,
				     layout,
				     text_color, NULL);
}

これを以下のように書き換えてみた。

void
eel_gdk_draw_layout_with_drop_shadow (GdkDrawable         *drawable,
				      GdkGC               *gc,
				      GdkColor            *text_color,
				      GdkColor            *shadow_color,
				      int                  x,
				      int                  y,
				      PangoLayout         *layout)
{
    GdkColor c;
    static const int sr = 3;
    int i;

    c.pixel = shadow_color->pixel;
    c.red   = ((guint32)shadow_color->red   * sr +
               (guint32)text_color->red     * (4 - sr)) / 4;
    c.green = ((guint32)shadow_color->green * sr +
               (guint32)text_color->green   * (4 - sr)) / 4;
    c.blue  = ((guint32)shadow_color->blue  * sr +
               (guint32)text_color->blue    * (4 - sr)) / 4;

    gdk_draw_layout_with_colors (drawable, gc,
                     x+2, y+2,
                     layout,
                     shadow_color, NULL);

    for (i = 0; i <= 1; ++i) {
        gdk_draw_layout_with_colors (drawable, gc,
                         x+i-1, y-1,
                         layout,
                         &c, NULL);
        gdk_draw_layout_with_colors (drawable, gc,
                         x+1, y+i-1,
                         layout,
                         &c, NULL);
        gdk_draw_layout_with_colors (drawable, gc,
                         x+i, y+1,
                         layout,
                         &c, NULL);
        gdk_draw_layout_with_colors (drawable, gc,
                         x-1, y+i,
                         layout,
                         &c, NULL);
    }

	gdk_draw_layout_with_colors (drawable, gc,
				     x, y,
				     layout,
				     text_color, NULL);
}

左が変更適用前、右が適用後。
f:id:moriyoshi:20070427121747p:image:left
f:id:moriyoshi:20070427121805p:image
どうだろうか。逆に見にくくなったって??