Option to shrink panel: add missing code for separator

This commit is contained in:
o9000 2016-10-09 15:03:48 +02:00
parent 278a915ba4
commit 7c54f2acf7

View file

@ -15,6 +15,8 @@
#include "common.h"
#include "separator.h"
int separator_compute_desired_size(void *obj);
Separator *create_separator()
{
Separator *separator = (Separator *)calloc(1, sizeof(Separator));
@ -83,6 +85,7 @@ void init_separator_panel(void *p)
separator->area.resize_needed = 1;
separator->area.on_screen = TRUE;
separator->area._resize = resize_separator;
separator->area._compute_desired_size = separator_compute_desired_size;
separator->area._draw_foreground = draw_separator;
instantiate_area_gradients(&separator->area);
}
@ -101,6 +104,18 @@ void cleanup_separator()
panel_config.separator_list = NULL;
}
int separator_compute_desired_size(void *obj)
{
Separator *separator = (Separator *)obj;
if (!separator->area.on_screen)
return 0;
if (panel_horizontal)
return separator->thickness + 2 * separator->area.paddingxlr + left_right_border_width(&separator->area);
else
return separator->thickness + 2 * separator->area.paddingxlr + top_bottom_border_width(&separator->area);
}
gboolean resize_separator(void *obj)
{
Separator *separator = (Separator *)obj;