]> Dogcows Code - chaz/tint2/commitdiff
back to ELLIPSIZE_END and multi-line task name. multi-line depend on task vertical_pa...
authorThierry Lorthiois <lorthiois@bbsoft.fr>
Mon, 19 Apr 2010 21:44:40 +0000 (21:44 +0000)
committerThierry Lorthiois <lorthiois@bbsoft.fr>
Mon, 19 Apr 2010 21:44:40 +0000 (21:44 +0000)
src/taskbar/task.c
src/taskbar/task.h
src/taskbar/taskbar.c

index 12476bc80250029451aa4354b93f89b6e38db39a..d4fa72f5d854a4ab6480fdda149715a9e85a3661 100644 (file)
@@ -348,39 +348,41 @@ 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_ellipsize (layout, PANGO_ELLIPSIZE_MIDDLE);
-               //pango_layout_set_wrap(layout, PANGO_WRAP_CHAR);
+               pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+               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);
 
                /* Center text */
                if (panel->g_task.centered) pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
                else pango_layout_set_alignment (layout, PANGO_ALIGN_LEFT);
 
                pango_layout_get_pixel_size (layout, &width, &height);
+               //printf("nombre de lignes  %d, w %d, h %d, text_height %d\n", pango_layout_get_line_count(layout), width, height, (int)panel->g_task.text_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);
        }
 }
index d519de1c23126d5f14cc63f606971fd614df7694..54695abe1096996d71daeaf638b74948b63de14b 100644 (file)
@@ -38,7 +38,7 @@ typedef struct {
        Background* background[TASK_STATE_COUNT];
        int config_background_mask;
        // starting position for text ~ task_padding + task_border + icon_size
-       double text_posx, text_posy;
+       double text_posx, text_height;
 
        int font_shadow;
        PangoFontDescription *font_desc;
index 34f49b0a52accebe6e2230d33376c04b930c4ea3..c89d3a66d0e487db56633112d27dd140f02b2c4e 100644 (file)
@@ -142,7 +142,7 @@ void init_taskbar()
                        panel->g_task.maximum_width = server.monitor[panel->monitor].width;
 
                panel->g_task.text_posx = panel->g_task.background[0]->border.width + panel->g_task.area.paddingxlr;
-               panel->g_task.text_posy = (panel->g_task.area.height - height) / 2.0;
+               panel->g_task.text_height = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
                if (panel->g_task.icon) {
                        panel->g_task.icon_size1 = panel->g_task.area.height - (2 * panel->g_task.area.paddingy);
                        panel->g_task.text_posx += panel->g_task.icon_size1;
This page took 0.025629 seconds and 4 git commands to generate.