cleanup : remove unneeded title change

git-svn-id: http://tint2.googlecode.com/svn/trunk@579 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
thilor77 2010-10-23 13:39:09 +00:00
parent 503a4b6845
commit eb07f935fe
4 changed files with 20 additions and 14 deletions

View file

@ -457,7 +457,6 @@ void add_entry (char *key, char *value)
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);

View file

@ -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);
}

View file

@ -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);

View file

@ -584,12 +584,13 @@ void event_property_notify (XEvent *e)
// 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) {