]> Dogcows Code - chaz/tint2/blobdiff - src/taskbar/task.c
cleanup code
[chaz/tint2] / src / taskbar / task.c
index d4fa72f5d854a4ab6480fdda149715a9e85a3661..83e827f5247ef181e1df0e51e5c95186f0c8b823 100644 (file)
@@ -209,7 +209,7 @@ void get_icon (Task *tsk)
        int i;
        Imlib_Image img = NULL;
        XWMHints *hints = 0;
-       long *data = 0;
+       gulong *data = 0;
 
        int k;
        for (k=0; k<TASK_STATE_COUNT; ++k) {
@@ -224,10 +224,9 @@ void get_icon (Task *tsk)
        if (data) {
                // get ARGB icon
                int w, h;
-               long *tmp_data;
+               gulong *tmp_data;
 
                tmp_data = get_best_icon (data, get_icon_count (data, i), i, &w, &h, panel->g_task.icon_size1);
-
 #ifdef __x86_64__
                DATA32 icon_data[w * h];
                int length = w * h;
@@ -343,6 +342,7 @@ void draw_task (void *obj, cairo_t *c)
        Color *config_text;
        int width=0, height;
        Panel *panel = (Panel*)tsk->area.panel;
+       //printf("draw_task %d %d\n", tsk->area.posx, tsk->area.posy);
 
        if (panel->g_task.text) {
                /* Layout */
@@ -352,20 +352,18 @@ void draw_task (void *obj, cairo_t *c)
 
                /* Drawing width and Cut text */
                // pango use U+22EF or U+2026
-               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);
+               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);
-               //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);
@@ -446,9 +444,11 @@ void active_task()
        //printf("Change active task %ld\n", w1);
 
        if (w1) {
-               Window w2;
-               if (XGetTransientForHint(server.dsp, w1, &w2) != 0)
-                       if (w2 && !task_get_tasks(w1)) w1 = w2;
+               if (!task_get_tasks(w1)) {
+                       Window w2;
+                       while (XGetTransientForHint(server.dsp, w1, &w2))
+                               w1 = w2;
+               }
                set_task_state((task_active = task_get_task(w1)), TASK_ACTIVE);
        }
 }
This page took 0.022439 seconds and 4 git commands to generate.