- PangoLayout *layout;
- config_color *config_text;
- int width, height;
-
- if (g_task.text) {
- /* Layout */
- layout = pango_cairo_create_layout (c);
- pango_layout_set_font_description (layout, g_task.font_desc);
- pango_layout_set_text (layout, tsk->title, -1);
-
- /* Drawing width and Cut text */
- pango_layout_set_width (layout, ((Taskbar*)tsk->area.parent)->text_width * PANGO_SCALE);
- pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
-
- /* Center text */
- if (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);
-
- if (active) config_text = &g_task.font_active;
- else config_text = &g_task.font;
-
- 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, g_task.text_posx, g_task.text_posy);
- pango_cairo_show_layout (c, layout);
-
- if (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, g_task.text_posx + 1, g_task.text_posy + 1);
- pango_cairo_show_layout (c, layout);
- }
- g_object_unref (layout);
- }
-
- if (g_task.icon) {
- // icon use same opacity as text
- draw_task_icon (tsk, width, active);
- }
-}
-
-
-void draw_background_task (void *obj, cairo_t *c)
-{
- Task *tsk = obj;
-
- draw_background (&tsk->area_active, c);
- draw_background (&tsk->area_inactive, c);
-}
-
-
-void draw_foreground_task (void *obj, cairo_t *c)
-{
- Task *tsk = obj;
- cairo_surface_t *cs;
- cairo_t *ca;
- //printf(" draw_foreground_task\n");
-
- draw_task_title (c, tsk, 0);
-
- // draw active pmap
- if (tsk->area_active.pmap) XFreePixmap (server.dsp, tsk->area_active.pmap);
- tsk->area_active.pmap = server_create_pixmap (tsk->area.width, tsk->area.height);
-
- // add layer of root pixmap
- XCopyArea (server.dsp, server.pmap, tsk->area_active.pmap, server.gc, tsk->area.posx, tsk->area.posy, tsk->area.width, tsk->area.height, 0, 0);
-
- cs = cairo_xlib_surface_create (server.dsp, tsk->area_active.pmap, server.visual, tsk->area.width, tsk->area.height);
- ca = cairo_create (cs);
-
- // redraw task
- draw_task_title (ca, tsk, 1);
-
- cairo_destroy (ca);
- cairo_surface_destroy (cs);
+ Task *tsk = obj;
+ PangoLayout *layout;
+ config_color *config_text;
+ int width=0, height;
+ Panel *panel = (Panel*)tsk->area.panel;
+
+ if (panel->g_task.text) {
+ /* 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);
+
+ /* 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_END);
+
+ /* 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);
+
+ if (active) config_text = &panel->g_task.font_active;
+ else config_text = &panel->g_task.font;
+
+ 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);
+ 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);
+ 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, active);
+ }