From cbe94d7c42422856275ad41332cbc980054d6bee Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Wed, 13 Mar 2024 23:19:32 +0100 Subject: Start refactoring state and draw --- src/draw.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/draw.c') diff --git a/src/draw.c b/src/draw.c index 69de9fd..814c310 100644 --- a/src/draw.c +++ b/src/draw.c @@ -8,17 +8,15 @@ #include "button.h" #include "log.h" -// TODO: Animations ?? - static void layout_destroy(Layout *layout) { if (layout->pl != NULL) g_object_unref(layout->pl); g_free(layout); } -Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, int line_w) +Drawer *draw_create(const char *font, int height, int left_pad, int right_pad, int top_pad, int line_w) { - Drawable *draw = g_malloc(sizeof(Drawable)); + Drawer *draw = g_malloc(sizeof(Drawer)); g_assert_nonnull(draw); log_debug("Pango loading font description '%s'", font); @@ -38,7 +36,7 @@ Drawable *draw_create(const char *font, int height, int left_pad, int right_pad, return draw; } -static void compute_width(Drawable *draw, Window *win, int *width, int *height) +static void compute_width(Drawer *draw, Window *win, int *width, int *height) { int screen_width = win->con->screen_size->width; int screen_height = win->con->screen_size->height; @@ -47,7 +45,7 @@ static void compute_width(Drawable *draw, Window *win, int *width, int *height) *height = round(draw->height); } -void draw_paint(Drawable *draw, Window *win) +void draw_paint(Drawer *draw, Window *win) { int width, height; compute_width(draw, win, &width, &height); @@ -135,7 +133,7 @@ static void layout_text(Layout *layout, PangoFontDescription *desc, int height, layout->height = height; } -void draw_compute_layout(Drawable *draw, Window *win, GList *btns) +void draw_compute_layout(Drawer *draw, Window *win, GList *btns) { g_list_free_full(draw->layouts, (GDestroyNotify)layout_destroy); draw->layouts = NULL; @@ -272,12 +270,12 @@ void draw_compute_layout(Drawable *draw, Window *win, GList *btns) log_debug("Updated layouts"); } -void draw_set_background(Drawable *draw, Color background) +void draw_set_background(Drawer *draw, Color background) { draw->background = background; } -void draw_destroy(Drawable *draw) +void draw_destroy(Drawer *draw) { g_list_free_full(draw->layouts, (GDestroyNotify)layout_destroy); pango_font_description_free(draw->desc); -- cgit v1.2.3