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 --- comet.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'comet.c') diff --git a/comet.c b/comet.c index 85bdb27..38c6db8 100644 --- a/comet.c +++ b/comet.c @@ -2,9 +2,10 @@ #include #include -#include "x11.h" +#include "window.h" #include "log.h" #include "draw.h" +#include "connection.h" #define EVEN(n) ((int)(n) - ((int)(n) % 2 != 0)) @@ -26,10 +27,13 @@ int main(int argc, char **argv) GMainLoop *mainloop = g_main_loop_new(NULL, FALSE); - Window *win = window_create(); + Connection *con = connection_create(); - int screen_width, screen_height; - window_get_screen_size(win, &screen_width, &screen_height); + Window *win = window_create(con); + + int screen_width = con->screen_size->width; + int screen_height = con->screen_size->height; + log_info("w=%d, h=%d", screen_width, screen_height); int height = EVEN(round(screen_height * 0.021)); int x_padding = EVEN(round(screen_width * 0.005)); -- cgit v1.2.3