diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b5a0f3..8752808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,6 +109,8 @@ if( RT_LIBRARY ) target_link_libraries( tint2 ${RT_LIBRARY} ) endif( RT_LIBRARY ) +target_link_libraries( tint2 m ) + add_dependencies( tint2 version ) set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -pthread" ) set_target_properties(tint2 PROPERTIES LINK_FLAGS "-pthread" ) diff --git a/src/taskbar/task.c b/src/taskbar/task.c index b5381b5..49f2a4c 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "window.h" #include "task.h" @@ -371,19 +372,27 @@ void draw_task (void *obj, cairo_t *c) pango_layout_get_pixel_size (layout, &width, &height); config_text = &panel->g_task.font[tsk->current_state]; - cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha); - pango_cairo_update_layout (c, layout); double text_posy = (panel->g_task.area.height - height) / 2.0; + + if (panel->g_task.font_shadow) { + const int shadow_size = 3; + const double shadow_edge_alpha = 0.05; + int i, j; + for (i = -shadow_size; i <= shadow_size; i++) { + for (j = -shadow_size; j <= shadow_size; j++) { + cairo_set_source_rgba(c, 0.0, 0.0, 0.0, 1.0 - (1.0 - shadow_edge_alpha) * sqrt((i*i + j*j)/(double)(shadow_size*shadow_size))); + pango_cairo_update_layout(c, layout); + cairo_move_to(c, panel->g_task.text_posx + i, text_posy + j); + pango_cairo_show_layout(c, layout); + } + } + } + cairo_set_source_rgba (c, config_text->color[0], config_text->color[1], config_text->color[2], config_text->alpha); + pango_cairo_update_layout (c, layout); cairo_move_to (c, panel->g_task.text_posx, text_posy); pango_cairo_show_layout (c, layout); - if (panel->g_task.font_shadow) { - cairo_set_source_rgba (c, 0.0, 0.0, 0.0, 0.5); - pango_cairo_update_layout (c, layout); - cairo_move_to (c, panel->g_task.text_posx + 1, text_posy + 1); - pango_cairo_show_layout (c, layout); - } g_object_unref (layout); }