all repos — tint2 @ 9ac902b62b321c2a552ceb8dcfcae46f1115b506

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

taskbar: draw softer shadows so that text is more readable

git-svn-id: http://tint2.googlecode.com/svn/trunk@661 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
o9000 o9000
commit

9ac902b62b321c2a552ceb8dcfcae46f1115b506

parent

42469038a808112b5c249479a401713bd38ab2f2

2 files changed, 19 insertions(+), 8 deletions(-)

jump to
M CMakeLists.txtCMakeLists.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" )
M src/taskbar/task.csrc/taskbar/task.c

@@ -26,6 +26,7 @@ #include <stdlib.h>

#include <string.h> #include <glib.h> #include <unistd.h> +#include <math.h> #include "window.h" #include "task.h"

@@ -371,19 +372,27 @@

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; - 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); + 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); + g_object_unref (layout); }