fixed segfault with icon

git-svn-id: http://tint2.googlecode.com/svn/trunk@20 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
lorthiois@bbsoft.fr 2008-11-12 23:23:15 +00:00
parent 9707ec36d2
commit d29f3771de
4 changed files with 31 additions and 13 deletions

View file

@ -1,5 +1,6 @@
2008-11-12
- fixed segfault with icon
- panel's left and right padding feel like WM background
(right click open window managers's menu, ...)

View file

@ -60,8 +60,14 @@ void add_task (Window win)
XSelectInput (server.dsp, new_tsk->win, PropertyChangeMask|StructureNotifyMask);
if (desktop == 0xFFFFFFFF) {
if (new_tsk->title) XFree (new_tsk->title);
if (new_tsk->icon_data) XFree (new_tsk->icon_data);
if (new_tsk->title) {
free (new_tsk->title);
new_tsk->title = 0;
}
if (new_tsk->icon_data) {
XFree (new_tsk->icon_data);
new_tsk->icon_data = 0;
}
free(new_tsk);
fprintf(stderr, "task on all desktop : ignored\n");
return;
@ -87,8 +93,14 @@ void remove_task (Task *tsk)
resize_tasks (tskbar);
redraw (&tskbar->area);
if (tsk->title) XFree (tsk->title);
if (tsk->icon_data) XFree (tsk->icon_data);
if (tsk->title) {
free (tsk->title);
tsk->title = 0;
}
if (tsk->icon_data) {
XFree (tsk->icon_data);
tsk->icon_data = 0;
}
XFreePixmap (server.dsp, tsk->area.pmap);
XFreePixmap (server.dsp, tsk->area_active.pmap);
free(tsk);
@ -101,8 +113,6 @@ void get_title(Task *tsk)
char *title, *name;
if (tsk->title) free(tsk->title);
name = server_get_property (tsk->win, server.atom._NET_WM_VISIBLE_NAME, server.atom.UTF8_STRING, 0);
if (!name || !strlen(name)) {
name = server_get_property (tsk->win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 0);
@ -116,12 +126,14 @@ void get_title(Task *tsk)
}
// add space before title
title = malloc(strlen(name)+1);
title = malloc(strlen(name)+2);
if (g_task.icon) strcpy(title, " ");
else title[0] = 0;
strcat(title, name);
if (name) XFree (name);
if (tsk->title)
free(tsk->title);
tsk->title = title;
}

BIN
src/tint2

Binary file not shown.

View file

@ -11,9 +11,14 @@ background_color = #000000 45
border_color = #ffffff 0
rounded = 7
border_width = 1
background_color = #ffffff 0
border_color = #ffffff 70
border_width = 0
background_color = #ffffff 20
border_color = #ffffff 15
rounded = 0
border_width = 0
background_color = #000000 35
border_color = #ffffff 0
#---------------------------------------------
@ -21,7 +26,7 @@ border_color = #ffffff 70
#---------------------------------------------
panel_monitor = 1
panel_position = bottom left
panel_size = 1010 30
panel_size = 0 30
panel_margin = 0 0
panel_padding = 11 2
font_shadow = 0
@ -44,7 +49,7 @@ task_centered = 1
task_padding = 2 2
task_font = sans bold 8
task_font_color = #ffffff 60
task_active_font_color = #ffffff 95
task_active_font_color = #ffffff 85
task_background_id = 0
task_active_background_id = 2