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,134 @@
/**
* @file lv_windows_context.h
*
*/
#ifndef LV_WINDOWS_CONTEXT_H
#define LV_WINDOWS_CONTEXT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#if LV_USE_OS != LV_OS_WINDOWS
#error [lv_windows] LV_OS_WINDOWS is required. Enable it in lv_conf.h (LV_USE_OS LV_OS_WINDOWS)
#endif
#include <windows.h>
#ifndef CREATE_WAITABLE_TIMER_MANUAL_RESET
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 0x00000001
#endif
#ifndef CREATE_WAITABLE_TIMER_HIGH_RESOLUTION
#define CREATE_WAITABLE_TIMER_HIGH_RESOLUTION 0x00000002
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct _lv_windows_pointer_context_t {
lv_indev_state_t state;
lv_point_t point;
lv_indev_t * indev;
} lv_windows_pointer_context_t;
typedef struct _lv_windows_keypad_queue_item_t {
uint32_t key;
lv_indev_state_t state;
} lv_windows_keypad_queue_item_t;
typedef struct _lv_windows_keypad_context_t {
lv_ll_t queue;
uint16_t utf16_high_surrogate;
uint16_t utf16_low_surrogate;
lv_indev_t * indev;
} lv_windows_keypad_context_t;
typedef struct _lv_windows_encoder_context_t {
lv_indev_state_t state;
int16_t enc_diff;
lv_indev_t * indev;
} lv_windows_encoder_context_t;
typedef struct _lv_windows_window_context_t {
lv_display_t * display_device_object;
lv_timer_t * display_timer_object;
int32_t window_dpi;
int32_t zoom_level;
bool allow_dpi_override;
bool simulator_mode;
bool display_resolution_changed;
lv_point_t requested_display_resolution;
HDC display_framebuffer_context_handle;
uint32_t * display_framebuffer_base;
size_t display_framebuffer_size;
lv_windows_pointer_context_t pointer;
lv_windows_keypad_context_t keypad;
lv_windows_encoder_context_t encoder;
} lv_windows_window_context_t;
typedef struct _lv_windows_create_display_data_t {
const wchar_t * title;
int32_t hor_res;
int32_t ver_res;
int32_t zoom_level;
bool allow_dpi_override;
bool simulator_mode;
HANDLE mutex;
lv_display_t * display;
} lv_windows_create_display_data_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Initialize the LVGL Windows backend.
* @remark This is a private API which is used for LVGL Windows backend
* implementation. LVGL users shouldn't use that because the
* LVGL has already used it in lv_init.
*/
void lv_windows_platform_init(void);
/**
* @brief Get the window context from specific LVGL display window.
* @param window_handle The window handle of specific LVGL display window.
* @return The window context from specific LVGL display window.
* @remark This is a private API which is used for LVGL Windows backend
* implementation. LVGL users shouldn't use that because the
* maintainer doesn't promise the application binary interface
* compatibility for this API.
*/
lv_windows_window_context_t * lv_windows_get_window_context(
HWND window_handle);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_CONTEXT_H*/
@@ -0,0 +1,127 @@
/**
* @file lv_windows_display.h
*
*/
#ifndef LV_WINDOWS_DISPLAY_H
#define LV_WINDOWS_DISPLAY_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#include <windows.h>
/*********************
* DEFINES
*********************/
#define LV_WINDOWS_ZOOM_BASE_LEVEL 100
#ifndef USER_DEFAULT_SCREEN_DPI
#define USER_DEFAULT_SCREEN_DPI 96
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Create a LVGL display object.
* @param title The window title of LVGL display.
* @param hor_res The horizontal resolution value of LVGL display.
* @param ver_res The vertical resolution value of LVGL display.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @param allow_dpi_override Allow DPI override if true, or follow the
* Windows DPI scaling setting dynamically.
* @param simulator_mode Create simulator mode display if true, or create
* application mode display.
* @return The created LVGL display object.
*/
lv_display_t * lv_windows_create_display(
const wchar_t * title,
int32_t hor_res,
int32_t ver_res,
int32_t zoom_level,
bool allow_dpi_override,
bool simulator_mode);
/**
* @brief Get the window handle from specific LVGL display object.
* @param display The specific LVGL display object.
* @return The window handle from specific LVGL display object.
*/
HWND lv_windows_get_display_window_handle(lv_display_t * display);
/**
* @brief Get logical pixel value from physical pixel value taken account
* with zoom level.
* @param physical The physical pixel value taken account with zoom level.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_logical(int32_t physical, int32_t zoom_level);
/**
* @brief Get physical pixel value taken account with zoom level from
* logical pixel value.
* @param logical The logical pixel value.
* @param zoom_level The zoom level value. Base value is 100 a.k.a 100%.
* @return The physical pixel value taken account with zoom level.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_zoom_to_physical(int32_t logical, int32_t zoom_level);
/**
* @brief Get logical pixel value from physical pixel value taken account
* with DPI scaling.
* @param physical The physical pixel value taken account with DPI scaling.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The logical pixel value.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_logical(int32_t physical, int32_t dpi);
/**
* @brief Get physical pixel value taken account with DPI scaling from
* logical pixel value.
* @param logical The logical pixel value.
* @param dpi The DPI scaling value. Base value is USER_DEFAULT_SCREEN_DPI.
* @return The physical pixel value taken account with DPI scaling.
* @remark It uses the same calculation style as Windows OS implementation.
* It will be useful for integrate LVGL Windows backend to other
* Windows applications.
*/
int32_t lv_windows_dpi_to_physical(int32_t logical, int32_t dpi);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_DISPLAY_H*/
@@ -0,0 +1,83 @@
/**
* @file lv_windows_input.h
*
*/
#ifndef LV_WINDOWS_INPUT_H
#define LV_WINDOWS_INPUT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../display/lv_display.h"
#include "../../indev/lv_indev.h"
#if LV_USE_WINDOWS
#include <windows.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* @brief Get the window handle from specific LVGL input device object.
* @param indev The specific LVGL input device object.
* @return The window handle from specific LVGL input device object.
*/
HWND lv_windows_get_indev_window_handle(lv_indev_t * indev);
/**
* @brief Open a LVGL pointer input device object for the specific LVGL
* display object, or create it if the LVGL pointer input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL pointer input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_pointer_indev(lv_display_t * display);
/**
* @brief Open a LVGL keypad input device object for the specific LVGL
* display object, or create it if the LVGL keypad input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL keypad input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_keypad_indev(lv_display_t * display);
/**
* @brief Open a LVGL encoder input device object for the specific LVGL
* display object, or create it if the LVGL encoder input device
* object is not created or removed before.
* @param display The specific LVGL display object.
* @return The LVGL encoder input device object for the specific LVGL
* display object.
*/
lv_indev_t * lv_windows_acquire_encoder_indev(lv_display_t * display);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_INPUT_H*/
@@ -0,0 +1,65 @@
/**
* @file lv_windows_input_private.h
*
*/
#ifndef LV_WINDOWS_INPUT_PRIVATE_H
#define LV_WINDOWS_INPUT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#if LV_USE_WINDOWS
#include <stdbool.h>
#include <windows.h>
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
bool lv_windows_pointer_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
bool lv_windows_keypad_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
bool lv_windows_encoder_device_window_message_handler(
HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam,
LRESULT * plResult);
/**********************
* MACROS
**********************/
#endif // LV_USE_WINDOWS
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_WINDOWS_INPUT_PRIVATE_H*/