all repos — tint2 @ eb07f935feb5a1fbe2b31c2960da60633940478c

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

cleanup : remove unneeded title change

git-svn-id: http://tint2.googlecode.com/svn/trunk@579 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
thilor77 thilor77@121b4492-b84c-0410-8b4c-0d4edfb3f3cc
commit

eb07f935feb5a1fbe2b31c2960da60633940478c

parent

503a4b68457e8c8ddb18711af2d2b5b158ce1685

4 files changed, 20 insertions(+), 14 deletions(-)

jump to
M src/config.csrc/config.c

@@ -457,7 +457,6 @@ id = (id < backgrounds->len && id >= 0) ? id : 0;

panel_config.g_taskbar.background[TASKBAR_NORMAL] = &g_array_index(backgrounds, Background, id); if (panel_config.g_taskbar.background[TASKBAR_ACTIVE] == 0) panel_config.g_taskbar.background[TASKBAR_ACTIVE] = panel_config.g_taskbar.background[TASKBAR_NORMAL]; - //panel_config.g_taskbar.area.bg = panel_config.g_taskbar.bg; } else if (strcmp (key, "taskbar_active_background_id") == 0) { int id = atoi (value);
M src/taskbar/task.csrc/taskbar/task.c

@@ -159,12 +159,12 @@ g_hash_table_remove(win_to_task_table, &win);

} -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 @@ if (panel->g_task.icon) strcpy(title, " ");

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 @@ tsk2->title = tsk->title;

set_task_redraw(tsk2); } } - set_task_redraw(tsk); + return 1; }

@@ -303,7 +310,6 @@ tsk2->icon[k] = tsk->icon[k];

set_task_redraw(tsk2); } } - set_task_redraw(tsk); }
M src/taskbar/task.hsrc/taskbar/task.h

@@ -72,7 +72,7 @@ void draw_task (void *obj, cairo_t *c);

void on_change_task (void *obj); void get_icon (Task *tsk); -void get_title(Task *tsk); +int get_title(Task *tsk); void active_task(); void set_task_state(Task* tsk, int state); void set_task_redraw(Task* tsk);
M src/tint.csrc/tint.c

@@ -584,12 +584,13 @@ //printf("atom root_win = %s, %s\n", XGetAtomName(server.dsp, at), tsk->title);

// Window title changed if (at == server.atom._NET_WM_VISIBLE_NAME || at == server.atom._NET_WM_NAME || at == server.atom.WM_NAME) { - get_title(tsk); - if (g_tooltip.mapped && (g_tooltip.area == (Area*)tsk)) { - tooltip_copy_text((Area*)tsk); - tooltip_update(); + if (get_title(tsk)) { + if (g_tooltip.mapped && (g_tooltip.area == (Area*)tsk)) { + tooltip_copy_text((Area*)tsk); + tooltip_update(); + } + panel_refresh = 1; } - panel_refresh = 1; } // Demand attention else if (at == server.atom._NET_WM_STATE) {