initial commit

This commit is contained in:
Carter Essen committed 2026-11-09 17:35:03 -05:00
commit cff2a21efc
550 files changed
+154887

No files matched your search

@@ -0,0 +1,142 @@
/*******************************************************************
*
* @file lv_wayland.h - Public functions of the LVGL Wayland client
*
* Based on the original file from the repository.
*
* Porting to LVGL 9.1
* 2024 EDGEMTech Ltd.
*
* See LICENCE.txt for details
*
* Author(s): EDGEMTech Ltd, Erik Tagirov ([email protected])
*
******************************************************************/
#ifndef LV_WAYLAND_H
#define LV_WAYLAND_H
#ifndef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WAYLAND
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef bool (*lv_wayland_display_close_f_t)(lv_display_t * disp);
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Retrieves the file descriptor of the wayland socket
*/
int lv_wayland_get_fd(void);
/**
* Creates a window
* @param hor_res The width of the window in pixels
* @param ver_res The height of the window in pixels
* @param title The title of the window
* @param close_cb The callback that will be execute when the user closes the window
* @return The LVGL display associated to the window
*/
lv_display_t * lv_wayland_window_create(uint32_t hor_res, uint32_t ver_res, char * title,
lv_wayland_display_close_f_t close_cb);
/**
* Closes the window programmatically
* @param disp Reference to the LVGL display associated to the window
*/
void lv_wayland_window_close(lv_display_t * disp);
/**
* Check if the window is open
* @param disp Reference to the LVGL display associated to the window
* @return true: The window is open
*/
bool lv_wayland_window_is_open(lv_display_t * disp);
/**
* Sets the fullscreen state of the window
* @param disp Reference to the LVGL display associated to the window
* @param fullscreen If true the window enters fullscreen
*/
void lv_wayland_window_set_fullscreen(lv_display_t * disp, bool fullscreen);
/**
* Sets the maximized state of the window
* @param disp Reference to the LVGL display associated to the window
* @param fullscreen If true the window is maximized
*/
void lv_wayland_window_set_maximized(lv_display_t * disp, bool maximize);
/**
* Obtains the input device of the mouse pointer
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_pointer(lv_display_t * disp);
/**
* Obtains the input device of the encoder
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_pointeraxis(lv_display_t * disp);
/**
* Obtains the input device of the keyboard
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_keyboard(lv_display_t * disp);
/**
* Obtains the input device of the touch screen
* @note It is used to create an input group on application start
* @param disp Reference to the LVGL display associated to the window
* @return The input device
*/
lv_indev_t * lv_wayland_get_touchscreen(lv_display_t * disp);
/**
* Wrapper around lv_timer_handler
* @note Must be called in the application run loop instead of the
* regular lv_timer_handler provided by LVGL
* @return true: if the cycle was completed, false if the application
* went to sleep because the last frame wasn't completed
*/
bool lv_wayland_timer_handler(void);
/**********************
* MACROS
**********************/
#endif /* LV_USE_WAYLAND */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _WIN32 */
#endif /* WAYLAND_H */
@@ -0,0 +1,105 @@
/**
* @file lv_wayland_smm.h
*
*/
#ifndef LV_WAYLAND_SMM_H
#define LV_WAYLAND_SMM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include LV_STDDEF_INCLUDE
#include LV_STDBOOL_INCLUDE
#if LV_USE_WAYLAND
/*********************
* DEFINES
*********************/
#define SMM_FD_NAME "lvgl-wayland"
#define SMM_POOL_TAGS (1)
#define SMM_BUFFER_TAGS (2)
#define SMM_GROUP_TAGS (1)
/**********************
* TYPEDEFS
**********************/
typedef void smm_pool_t;
typedef void smm_buffer_t;
typedef void smm_group_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
struct smm_events {
void * ctx;
bool (*new_pool)(void * ctx, smm_pool_t * pool);
void (*expand_pool)(void * ctx, smm_pool_t * pool);
void (*free_pool)(void * ctx, smm_pool_t * pool);
bool (*new_buffer)(void * ctx, smm_buffer_t * buf);
bool (*init_buffer)(void * ctx, smm_buffer_t * buf);
void (*free_buffer)(void * ctx, smm_buffer_t * buf);
};
struct smm_pool_properties {
void * tag[SMM_POOL_TAGS];
size_t size;
int fd;
};
struct smm_buffer_properties {
void * tag[SMM_BUFFER_TAGS];
smm_group_t * const group;
smm_pool_t * const pool;
size_t offset;
};
struct smm_group_properties {
void * tag[SMM_GROUP_TAGS];
};
void smm_init(struct smm_events * evs);
void smm_setctx(void * ctx);
void smm_deinit(void);
smm_group_t * smm_create(void);
void smm_resize(smm_group_t * grp, size_t sz);
void smm_destroy(smm_group_t * grp);
smm_buffer_t * smm_acquire(smm_group_t * grp);
void * smm_map(smm_buffer_t * buf);
void smm_release(smm_buffer_t * buf);
smm_buffer_t * smm_latest(smm_group_t * grp);
smm_buffer_t * smm_next(smm_buffer_t * buf);
/**********************
* MACROS
**********************/
#define SMM_POOL_PROPERTIES(p) ((const struct smm_pool_properties *)(p))
#define SMM_BUFFER_PROPERTIES(b) ((const struct smm_buffer_properties *)(b))
#define SMM_GROUP_PROPERTIES(g) ((const struct smm_group_properties *)(g))
#define SMM_TAG(o, n, v) \
do { \
void **smm_tag = (void **)((char *)o + (n * sizeof(void *))); \
*smm_tag = (v); \
} while(0)
#endif /* LV_USE_WAYLAND */
#endif /* _WIN32 */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /* LV_WAYLAND_SMM_H */