]> Dogcows Code - chaz/tint2/blobdiff - src/taskbar/task.c
fixed Issue 282
[chaz/tint2] / src / taskbar / task.c
index 92a6ff80a365a0ed3b47f745fc692b94e9075c4a..a096af30d7332b43b7069c8f4a777f97b20f2bf5 100644 (file)
@@ -35,8 +35,8 @@
 #include "tooltip.h"
 #include "timer.h"
 
-static timeout* urgent_timeout = 0;
-static GSList* urgent_list = 0;
+timeout* urgent_timeout;
+GSList* urgent_list;
 
 const char* task_get_tooltip(void* obj)
 {
@@ -221,7 +221,7 @@ void get_icon (Task *tsk)
        }
 
        data = server_get_property (tsk->win, server.atom._NET_WM_ICON, XA_CARDINAL, &i);
-       if (data) {
+       if (data && i) {
                // get ARGB icon
                int w, h;
                long *tmp_data;
@@ -325,7 +325,7 @@ void draw_task_icon (Task *tsk, int text_width)
 
        // Render
        imlib_context_set_image (tsk->icon[tsk->current_state]);
-       if (real_transparency) {
+       if (server.real_transparency) {
                render_image(tsk->area.pix, pos_x, panel->g_task.icon_posy, imlib_image_get_width(), imlib_image_get_height() );
        }
        else {
@@ -348,11 +348,13 @@ void draw_task (void *obj, cairo_t *c)
                /* Layout */
                layout = pango_cairo_create_layout (c);
                pango_layout_set_font_description (layout, panel->g_task.font_desc);
-               pango_layout_set_text (layout, tsk->title, -1);
+               pango_layout_set_text(layout, tsk->title, -1);
 
                /* Drawing width and Cut text */
                // pango use U+22EF or U+2026
-               pango_layout_set_width (layout, ((Taskbar*)tsk->area.parent)->text_width * PANGO_SCALE);
+               pango_layout_set_width(layout, ((Taskbar*)tsk->area.parent)->text_width * PANGO_SCALE);
+               pango_layout_set_height(layout, panel->g_task.text_height * PANGO_SCALE);
+               pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);
                pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
 
                /* Center text */
@@ -362,24 +364,23 @@ 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);
-               cairo_move_to (c, panel->g_task.text_posx, panel->g_task.text_posy);
+               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, panel->g_task.text_posy + 1);
+                       cairo_move_to (c, panel->g_task.text_posx + 1, text_posy + 1);
                        pango_cairo_show_layout (c, layout);
                }
                g_object_unref (layout);
        }
 
        if (panel->g_task.icon) {
-               // icon use same opacity as text
                draw_task_icon (tsk, width);
        }
 }
This page took 0.021562 seconds and 4 git commands to generate.