Option to shrink panel: add missing code for separator
o9000 mrovi9000@gmail.com
1 files changed,
15 insertions(+),
0 deletions(-)
jump to
M
src/separator/separator.c
→
src/separator/separator.c
@@ -15,6 +15,8 @@ #include "panel.h"
#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 @@ separator->area.size_mode = LAYOUT_FIXED;
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); }@@ -99,6 +102,18 @@
// Cleanup backends g_list_free_full(panel_config.separator_list, destroy_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)