diff options
| author | Federico Angelilli <code@fedang.net> | 2024-03-13 23:19:32 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-03-13 23:19:32 +0100 |
| commit | cbe94d7c42422856275ad41332cbc980054d6bee (patch) | |
| tree | 08564115751ff681615988bfab5750db95acc43c /src/draw.c | |
| parent | 4df262ade044448f83092ab157a15b4a3f170eec (diff) | |
Start refactoring state and draw
Diffstat (limited to 'src/draw.c')
| -rw-r--r-- | src/draw.c | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -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); |
