[lvgl][simulator] sync upstream win32 driver (#7165)

This commit is contained in:
Man, Jianting (Meco) 2023-04-05 01:27:14 -04:00 committed by GitHub
parent 8baaf73210
commit 5c70c9e402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 727 additions and 358 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,11 @@
#if USE_WIN32DRV
#include <Windows.h>
#if LV_USE_USER_DATA == 0
#error "Support for user data is required by new Win32 driver. Set LV_USE_USER_DATA to 1 in lv_conf.h"
#endif
#include <windows.h>
#if _MSC_VER >= 1200
// Disable compilation warnings.
@ -34,10 +38,50 @@
* DEFINES
*********************/
#define LVGL_SIMULATOR_WINDOW_CLASS L"LVGL.SimulatorWindow"
/**********************
* TYPEDEFS
**********************/
typedef struct _lv_win32_keyboard_queue_item_t
{
SLIST_ENTRY ItemEntry;
uint32_t key;
lv_indev_state_t state;
} lv_win32_keyboard_queue_item_t;
typedef struct _lv_win32_window_context_t
{
lv_disp_t* display_device_object;
lv_indev_t* mouse_device_object;
lv_indev_t* mousewheel_device_object;
lv_indev_t* keyboard_device_object;
lv_coord_t display_hor_res;
lv_coord_t display_ver_res;
uint32_t display_dpi;
HDC display_framebuffer_context_handle;
uint32_t* display_framebuffer_base;
size_t display_framebuffer_size;
lv_disp_draw_buf_t display_buffer;
lv_disp_drv_t display_driver;
lv_indev_state_t mouse_state;
lv_point_t mouse_point;
lv_indev_drv_t mouse_driver;
lv_indev_state_t mousewheel_state;
int16_t mousewheel_enc_diff;
lv_indev_drv_t mousewheel_driver;
CRITICAL_SECTION keyboard_mutex;
PSLIST_HEADER keyboard_queue;
uint16_t keyboard_utf16_high_surrogate;
uint16_t keyboard_utf16_low_surrogate;
lv_indev_drv_t keyboard_driver;
} lv_win32_window_context_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
@ -51,6 +95,19 @@ EXTERN_C lv_indev_t* lv_win32_encoder_device_object;
EXTERN_C void lv_win32_add_all_input_devices_to_group(
lv_group_t* group);
EXTERN_C lv_win32_window_context_t* lv_win32_get_window_context(
HWND window_handle);
EXTERN_C bool lv_win32_init_window_class();
EXTERN_C HWND lv_win32_create_display_window(
const wchar_t* window_title,
lv_coord_t hor_res,
lv_coord_t ver_res,
HINSTANCE instance_handle,
HICON icon_handle,
int show_window_mode);
EXTERN_C bool lv_win32_init(
HINSTANCE instance_handle,
int show_window_mode,