diff --git a/backend/fbdev.c b/backend/fbdev.c index 703962a..a90777e 100644 --- a/backend/fbdev.c +++ b/backend/fbdev.c @@ -14,7 +14,6 @@ #include "linux_input.h" #include "linux_vt.h" -#include "twin_backend.h" #include "twin_private.h" #define FBDEV_NAME "FRAMEBUFFER" diff --git a/backend/sdl.c b/backend/sdl.c index 879d65f..90a19d7 100644 --- a/backend/sdl.c +++ b/backend/sdl.c @@ -9,7 +9,7 @@ #include #include -#include "twin_backend.h" +#include "twin_private.h" typedef struct { SDL_Window *win; diff --git a/backend/vnc.c b/backend/vnc.c index d5dfbd8..8c08029 100644 --- a/backend/vnc.c +++ b/backend/vnc.c @@ -12,7 +12,6 @@ All rights reserved. #include #include -#include "twin_backend.h" #include "twin_private.h" #define SCREEN(x) ((twin_context_t *) x)->screen diff --git a/src/api.c b/src/api.c index 0af4666..d7d808d 100644 --- a/src/api.c +++ b/src/api.c @@ -7,7 +7,7 @@ #include #include -#include "twin_backend.h" +#include "twin_private.h" /* FIXME: Refine API design */ diff --git a/src/dispatch.c b/src/dispatch.c index be5980b..1eef8f8 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -7,7 +7,6 @@ #include -#include "twin_backend.h" #include "twin_private.h" extern twin_backend_t g_twin_backend; diff --git a/src/twin_backend.h b/src/twin_backend.h deleted file mode 100644 index 5f02da1..0000000 --- a/src/twin_backend.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Twin - A Tiny Window System - * Copyright (c) 2024 National Cheng Kung University, Taiwan - * All rights reserved. - */ - -#ifndef _TWIN_BACKEND_H_ -#define _TWIN_BACKEND_H_ - -#include - -#include "twin_private.h" - -typedef struct twin_backend { - /* Initialize the backend */ - twin_context_t *(*init)(int width, int height); - - /* Configure the device */ - /* FIXME: Refine the parameter list */ - void (*configure)(twin_context_t *ctx); - - bool (*poll)(twin_context_t *ctx); - - /* Device cleanup when drawing is done */ - void (*exit)(twin_context_t *ctx); -} twin_backend_t; - -#endif /* _TWIN_BACKEND_H_ */ diff --git a/include/twin_private.h b/src/twin_private.h similarity index 98% rename from include/twin_private.h rename to src/twin_private.h index 21bb825..3a4d3c1 100644 --- a/include/twin_private.h +++ b/src/twin_private.h @@ -8,6 +8,7 @@ #ifndef _TWIN_PRIVATE_H_ #define _TWIN_PRIVATE_H_ +#include #include #include @@ -16,7 +17,7 @@ /* FIXME: Both twin_private.h and log.h are private header files. They should * be moved to src/ directory. */ -#include "../src/log.h" +#include "log.h" /* Boilerplate for compiler compatibility */ #ifndef __has_attribute @@ -631,6 +632,20 @@ void _twin_button_init(twin_button_t *button, twin_style_t font_style, twin_dispatch_proc_t dispatch); +typedef struct twin_backend { + /* Initialize the backend */ + twin_context_t *(*init)(int width, int height); + + /* Configure the device */ + /* FIXME: Refine the parameter list */ + void (*configure)(twin_context_t *ctx); + + bool (*poll)(twin_context_t *ctx); + + /* Device cleanup when drawing is done */ + void (*exit)(twin_context_t *ctx); +} twin_backend_t; + /* * Visual effect stuff */