all repos — tint2 @ da8a26065915e67c6a0e675ae1edaf49026bd278

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

*fix* memleak
*fix* issue 192



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

da8a26065915e67c6a0e675ae1edaf49026bd278

parent

6cdf27ddfdcd4e5296a2f030ad59afaa787fc622

3 files changed, 14 insertions(+), 1 deletions(-)

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

@@ -66,6 +66,7 @@ static int old_config_file;

// temporary list of background static GSList *list_back; +static int back_count;

@@ -73,6 +74,7 @@ void init_config()

{ // append full transparency background list_back = g_slist_append(0, calloc(1, sizeof(Area))); + back_count = 1; // tint2 could reload config, so we cleanup objects cleanup_systray();

@@ -192,6 +194,7 @@ // 'rounded' is the first parameter => alloc a new background

Area *a = calloc(1, sizeof(Area)); a->pix.border.rounded = atoi (value); list_back = g_slist_append(list_back, a); + back_count++; } else if (strcmp (key, "border_width") == 0) { Area *a = g_slist_last(list_back)->data;

@@ -284,6 +287,7 @@ else if (strcmp (key, "font_shadow") == 0)

panel_config.g_task.font_shadow = atoi (value); else if (strcmp (key, "panel_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.area.pix.border, &a->pix.border, sizeof(Border));

@@ -357,6 +361,7 @@ }

else if (strcmp (key, "battery_background_id") == 0) { #ifdef ENABLE_BATTERY int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.battery.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.battery.area.pix.border, &a->pix.border, sizeof(Border));

@@ -402,6 +407,7 @@ if (value3) panel_config.clock.area.paddingx = atoi (value3);

} else if (strcmp (key, "clock_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.clock.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.clock.area.pix.border, &a->pix.border, sizeof(Border));

@@ -436,12 +442,14 @@ if (value3) panel_config.g_taskbar.paddingx = atoi (value3);

} else if (strcmp (key, "taskbar_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.g_taskbar.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.g_taskbar.pix.border, &a->pix.border, sizeof(Border)); } else if (strcmp (key, "taskbar_active_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.g_taskbar.pix_active.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.g_taskbar.pix_active.border, &a->pix.border, sizeof(Border));

@@ -502,12 +510,14 @@ panel_config.g_task.brightness_active = atoi(value3);

} else if (strcmp (key, "task_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.g_task.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.g_task.area.pix.border, &a->pix.border, sizeof(Border)); } else if (strcmp (key, "task_active_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&panel_config.g_task.area.pix_active.back, &a->pix.back, sizeof(Color)); memcpy(&panel_config.g_task.area.pix_active.border, &a->pix.border, sizeof(Border));

@@ -529,6 +539,7 @@ if (value3) systray.area.paddingx = atoi (value3);

} else if (strcmp (key, "systray_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&systray.area.pix.back, &a->pix.back, sizeof(Color)); memcpy(&systray.area.pix.border, &a->pix.border, sizeof(Border));

@@ -571,6 +582,7 @@ if (value2) g_tooltip.paddingy = atoi(value2);

} else if (strcmp (key, "tooltip_background_id") == 0) { int id = atoi (value); + id = id < back_count ? id : 0; Area *a = g_slist_nth_data(list_back, id); memcpy(&g_tooltip.background_color, &a->pix.back, sizeof(Color)); memcpy(&g_tooltip.border, &a->pix.border, sizeof(Border));
M src/systray/systraybar.csrc/systray/systraybar.c

@@ -516,7 +516,7 @@ else {

render_image(panel->main_win, traywin->x, traywin->y, traywin->width, traywin->height); render_image(systray.area.pix.pmap, traywin->x-systray.area.posx, traywin->y-systray.area.posy, traywin->width, traywin->height); } - imlib_free_image(); + imlib_free_image_and_decache(); }
M src/util/area.csrc/util/area.c

@@ -256,4 +256,5 @@ {

Picture pict = XRenderCreatePicture(server.dsp, p, XRenderFindVisualFormat(server.dsp, server.visual), 0, 0); XRenderColor col = { .red=0, .green=0, .blue=0, .alpha=0 }; XRenderFillRectangle(server.dsp, PictOpSrc, pict, &col, x, y, w, h); + XRenderFreePicture(server.dsp, pict); }