Hide executor if output is empty (issue #648)
This commit is contained in:
parent
30429b88b3
commit
6f05c9d327
3 changed files with 32 additions and 17 deletions
|
@ -188,6 +188,8 @@ void init_execp_panel(void *p)
|
|||
|
||||
if (!execp->backend->timer)
|
||||
execp->backend->timer = add_timeout(10, 0, execp_timer_callback, execp, &execp->backend->timer);
|
||||
|
||||
execp_update_post_read(execp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,21 +323,6 @@ void execp_compute_icon_text_geometry(Execp *execp,
|
|||
*icon_w = *icon_h = 0;
|
||||
}
|
||||
|
||||
if ((*icon_h == 0 || *icon_w == 0) && execp->backend->text[0] == 0) {
|
||||
*new_size = 0;
|
||||
*txt_height_ink = 0;
|
||||
*txt_height = 0;
|
||||
*txt_width = 0;
|
||||
if (panel_horizontal) {
|
||||
if (area->width)
|
||||
*resized = TRUE;
|
||||
} else {
|
||||
if (area->height)
|
||||
*resized = TRUE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
*text_next_line = !panel_horizontal && *icon_w > area->width / 2;
|
||||
|
||||
int available_w, available_h;
|
||||
|
@ -850,3 +837,29 @@ char *execp_get_tooltip(void *obj)
|
|||
}
|
||||
return strdup(execp->backend->tooltip_text);
|
||||
}
|
||||
|
||||
void execp_update_post_read(Execp *execp)
|
||||
{
|
||||
int icon_h, icon_w;
|
||||
if (reload_icon(execp)) {
|
||||
if (execp->backend->icon) {
|
||||
imlib_context_set_image(execp->backend->icon);
|
||||
icon_w = imlib_image_get_width();
|
||||
icon_h = imlib_image_get_height();
|
||||
} else {
|
||||
icon_w = icon_h = 0;
|
||||
}
|
||||
} else {
|
||||
icon_w = icon_h = 0;
|
||||
}
|
||||
|
||||
if ((icon_h == 0 || icon_w == 0) && execp->backend->text[0] == 0) {
|
||||
if (execp->area.on_screen)
|
||||
hide(&execp->area);
|
||||
} else {
|
||||
if (!execp->area.on_screen)
|
||||
show(&execp->area);
|
||||
execp->area.resize_needed = TRUE;
|
||||
schedule_panel_redraw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,6 +138,9 @@ void execp_cmd_completed(Execp *obj, pid_t pid);
|
|||
// Returns 1 if the output has been updated and a redraw is needed.
|
||||
gboolean read_execp(void *obj);
|
||||
|
||||
// Called for Execp front elements when the command output has changed.
|
||||
void execp_update_post_read(Execp *execp);
|
||||
|
||||
void execp_default_font_changed();
|
||||
|
||||
#endif // EXECPLUGIN_H
|
||||
|
|
|
@ -1865,8 +1865,7 @@ start:
|
|||
GList *l_instance;
|
||||
for (l_instance = execp->backend->instances; l_instance; l_instance = l_instance->next) {
|
||||
Execp *instance = l_instance->data;
|
||||
instance->area.resize_needed = TRUE;
|
||||
schedule_panel_redraw();
|
||||
execp_update_post_read(instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue