From 22086e50382b99de092899a203e520c30f50b618 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Wed, 15 Nov 2023 22:35:41 +0100 Subject: Add `Connection` to separate xcb setup from window logic --- draw.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index afd727e..440231b 100644 --- a/draw.c +++ b/draw.c @@ -3,7 +3,7 @@ #include #include -#include "x11.h" +#include "draw.h" #include "log.h" // Make this a state passed to draw @@ -28,7 +28,8 @@ void draw(Window *win) int screen_width, screen_height; window_get_screen_size(win, &screen_width, &screen_height); - int width = round((screen_width - 2 * draw_x_padding) * scale); + int width0 = screen_width - 2 * draw_x_padding; + int width = round(width0 * scale); int height = round(draw_height * scale); cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); @@ -98,7 +99,7 @@ void draw(Window *win) // TODO: Move these somewhere else window_move(win, x, y); - window_resize(win, width, height); + window_resize(win, width0, draw_height); window_paint_surface(win, surface, width, height); cairo_surface_destroy(surface); -- cgit v1.2.3