diff options
Diffstat (limited to 'src/lib/libwidget/include')
-rw-r--r-- | src/lib/libwidget/include/libwidget/core.h | 10 | ||||
-rw-r--r-- | src/lib/libwidget/include/libwidget/window.h | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/lib/libwidget/include/libwidget/core.h b/src/lib/libwidget/include/libwidget/core.h index 85b33d4..074edc4 100644 --- a/src/lib/libwidget/include/libwidget/core.h +++ b/src/lib/libwidget/include/libwidget/core.h @@ -30,12 +30,14 @@ #ifndef LIBWIDGET_CORE_H #define LIBWIDGET_CORE_H 1 +#include <sys/fbdev.h> #include <stdint.h> /* Forward declarations */ struct widget; struct libwidget_state { + struct fb_info fbinfo; uint32_t *fbdev; }; @@ -82,8 +84,8 @@ struct blueprint { * @draw: Draw the widget */ struct widget_ops { - int(*init)(struct widget *wp); - int(*draw)(struct widget *wp); + int(*init)(struct libwidget_state *lws, struct widget *wp); + int(*draw)(struct libwidget_state *lws, struct widget *wp); }; /* @@ -106,12 +108,10 @@ struct widget { /* * Initialize the library * - * @lwsp: Libwidget state pointer - * * Returns zero on success, otherwise a less than zero * value on failure. */ -int libwidget_init(struct libwidget_state *lwsp); +int libwidget_init(void); /* * Initialize a widget diff --git a/src/lib/libwidget/include/libwidget/window.h b/src/lib/libwidget/include/libwidget/window.h index 2dc58b1..8823eba 100644 --- a/src/lib/libwidget/include/libwidget/window.h +++ b/src/lib/libwidget/include/libwidget/window.h @@ -30,6 +30,7 @@ #ifndef LIBWIDGET_WINDOW_H #define LIBWIDGET_WINDOW_H +#include <sys/cdefs.h> #include <libwidget/core.h> /* @@ -41,6 +42,12 @@ struct window { struct widget *wp; }; +__always_inline static inline size_t +get_pix_index(struct fb_info *info, uint32_t x, uint32_t y) +{ + return x + y * (info->pitch / 4); +} + extern struct widget_ops g_winops; #endif /* !LIBWIDGET_WINDOW_H */ |