X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Ftaskbar%2Ftask.c;h=dec695f8cf4b588dcb16180d0de233c035876abd;hb=055e4228a91f9957771e44cbdc540f20b2c3aa17;hp=b132ae68e69e0a36666e59c0eb230c858af8af9f;hpb=1aa4d290a90cfc14416f43b205523a6bf401d973;p=chaz%2Ftint2 diff --git a/src/taskbar/task.c b/src/taskbar/task.c index b132ae6..dec695f 100644 --- a/src/taskbar/task.c +++ b/src/taskbar/task.c @@ -3,7 +3,7 @@ * Tint2 : task * * Copyright (C) 2007 PÃ¥l Staurland (staura@gmail.com) -* Modified (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) +* Modified (C) 2008 thierry lorthiois (lorthiois@bbsoft.fr) from Omega distribution * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 @@ -159,12 +159,12 @@ void remove_task (Task *tsk) } -void get_title(Task *tsk) +int get_title(Task *tsk) { Panel *panel = tsk->area.panel; char *title, *name; - if (!panel->g_task.text && !g_tooltip.enabled) return; + if (!panel->g_task.text && !g_tooltip.enabled) return 0; name = server_get_property (tsk->win, server.atom._NET_WM_VISIBLE_NAME, server.atom.UTF8_STRING, 0); if (!name || !strlen(name)) { @@ -184,9 +184,16 @@ void get_title(Task *tsk) else title[0] = 0; strcat(title, name); if (name) XFree (name); - - if (tsk->title) - free(tsk->title); + + if (tsk->title) { + // check unecessary title change + if (strcmp(tsk->title, title) == 0) { + free(title); + return 0; + } + else + free(tsk->title); + } tsk->title = title; GPtrArray* task_group = task_get_tasks(tsk->win); @@ -198,7 +205,7 @@ void get_title(Task *tsk) set_task_redraw(tsk2); } } - set_task_redraw(tsk); + return 1; } @@ -303,7 +310,6 @@ void get_icon (Task *tsk) set_task_redraw(tsk2); } } - set_task_redraw(tsk); } @@ -344,9 +350,6 @@ void draw_task (void *obj, cairo_t *c) Panel *panel = (Panel*)tsk->area.panel; //printf("draw_task %d %d\n", tsk->area.posx, tsk->area.posy); - long value[] = { panel->posx+tsk->area.posx, panel->posy+tsk->area.posy, tsk->area.width, tsk->area.height }; - XChangeProperty (server.dsp, tsk->win, server.atom._NET_WM_ICON_GEOMETRY, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)value, 4); - if (panel->g_task.text) { /* Layout */ layout = pango_cairo_create_layout (c); @@ -389,6 +392,19 @@ void draw_task (void *obj, cairo_t *c) } +void on_change_task (void *obj) +{ + Task *tsk = obj; + Panel *panel = (Panel*)tsk->area.panel; + + long value[] = { panel->posx+tsk->area.posx, panel->posy+tsk->area.posy, tsk->area.width, tsk->area.height }; + XChangeProperty (server.dsp, tsk->win, server.atom._NET_WM_ICON_GEOMETRY, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)value, 4); + + // reset Pixmap when position/size changed + set_task_redraw(tsk); +} + + Task *next_task(Task *tsk) { if (tsk == 0)