X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Flauncher%2Flauncher.c;h=ea456546318be4fd5414353e4388fcae089fc6fa;hb=928fc258ac46f2cc098f714921c028351b07ec31;hp=6418a4cebc447205e30a5f22e5d4fac10fe2cbfa;hpb=dc4092064f5febcc3bea4e4a19905ac99b6f628e;p=chaz%2Ftint2 diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 6418a4c..ea45654 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -70,8 +70,12 @@ void init_launcher_panel(void *p) launcher->area._resize = resize_launcher; launcher->area.resize = 1; launcher->area.redraw = 1; - launcher->area.on_screen = 1; + // check consistency + if (launcher->list_apps == NULL) + return; + + launcher->area.on_screen = 1; if (panel_horizontal) { // panel horizonal => fixed height and posy launcher->area.posy = panel->area.bg->border.width + panel->area.paddingy; @@ -149,10 +153,10 @@ void cleanup_launcher() launcher_enabled = 0; } -void resize_launcher(void *obj) + +int resize_launcher(void *obj) { Launcher *launcher = obj; - Panel *panel = launcher->area.panel; GSList *l; int count, icon_size; int icons_per_column=1, icons_per_row=1, marging=0; @@ -222,9 +226,6 @@ void resize_launcher(void *obj) icons_per_row = count / icons_per_column + (count%icons_per_column != 0); launcher->area.width = (2 * launcher->area.bg->border.width) + (2 * launcher->area.paddingxlr) + (icon_size * icons_per_row) + ((icons_per_row-1) * launcher->area.paddingx); } - - launcher->area.posx = panel->area.bg->border.width + panel->area.paddingxlr; - launcher->area.posy = panel->area.bg->border.width; } else { if (!count) launcher->area.height = 0; @@ -236,9 +237,6 @@ void resize_launcher(void *obj) icons_per_column = count / icons_per_row+ (count%icons_per_row != 0); launcher->area.height = (2 * launcher->area.bg->border.width) + (2 * launcher->area.paddingxlr) + (icon_size * icons_per_column) + ((icons_per_column-1) * launcher->area.paddingx); } - - launcher->area.posx = panel->area.bg->border.width; - launcher->area.posy = panel->area.height - panel->area.bg->border.width - panel->area.paddingxlr - launcher->area.height; } int i, posx, posy; @@ -274,9 +272,7 @@ void resize_launcher(void *obj) } } } - - // resize force the redraw - launcher->area.redraw = 1; + return 1; } @@ -372,7 +368,7 @@ void expand_exec(DesktopEntry *entry, const char *path) // %c -> Name // %k -> path if (entry->exec) { - char *exec2 = malloc(strlen(entry->exec) + strlen(entry->name) + strlen(entry->icon) + 100); + char *exec2 = malloc(strlen(entry->exec) + (entry->name ? strlen(entry->name) : 1) + (entry->icon ? strlen(entry->icon) : 1) + 100); char *p, *q; // p will never point to an escaped char for (p = entry->exec, q = exec2; *p; p++, q++) {