X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftaskbar%2Ftask.c;h=2e0cc93133a237ba231293fe17da38e3300a5980;hb=b68d4db999a5912c2fc7f29aef8ab75e2f742706;hp=50a64d4c5a9c7d61f2565f8807052b9a712e742c;hpb=da65866b2388391052e3ce95818c1d5ebd2b26b5;p=chaz%2Ftint2 diff --git a/src/taskbar/task.c b/src/taskbar/task.c index 50a64d4..2e0cc93 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -34,10 +34,10 @@ -void add_task (Window win) +Task *add_task (Window win) { - if (!win) return; - if (window_is_hidden(win)) return; + if (!win) return 0; + if (window_is_hidden(win)) return 0; int monitor; @@ -45,7 +45,7 @@ void add_task (Window win) new_tsk.win = win; new_tsk.area.panel = &panel1[0]; new_tsk.desktop = window_get_desktop (win); - if (panel_mode == SINGLE_MONITOR) monitor = window_get_monitor (win); + if (nb_panel > 1) monitor = window_get_monitor (win); else monitor = 0; // allocate only one title and one icon @@ -59,12 +59,12 @@ void add_task (Window win) XSelectInput (server.dsp, new_tsk.win, PropertyChangeMask|StructureNotifyMask); Taskbar *tskbar; - Task *new_tsk2; + Task *new_tsk2=0; int i, j; for (i=0 ; i < nb_panel ; i++) { for (j=0 ; j < panel1[i].nb_desktop ; j++) { if (new_tsk.desktop != ALLDESKTOP && new_tsk.desktop != j) continue; - if (panel_mode == SINGLE_MONITOR && panel1[i].monitor != monitor) continue; + if (nb_panel > 1 && panel1[i].monitor != monitor) continue; tskbar = &panel1[i].taskbar[j]; new_tsk2 = malloc(sizeof(Task)); @@ -81,6 +81,7 @@ void add_task (Window win) //printf("add_task panel %d, desktop %d, task %s\n", i, j, new_tsk2->title); } } + return new_tsk2; } @@ -283,12 +284,12 @@ void draw_task_icon (Task *tsk, int text_width, int active) } -void draw_foreground_task (void *obj, cairo_t *c, int active) +void draw_task (void *obj, cairo_t *c, int active) { Task *tsk = obj; PangoLayout *layout; config_color *config_text; - int width, height; + int width=0, height; Panel *panel = (Panel*)tsk->area.panel; if (panel->g_task.text) { @@ -298,6 +299,7 @@ void draw_foreground_task (void *obj, cairo_t *c, int active) 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);