summaryrefslogtreecommitdiff
path: root/lib/lvgl/src/drivers/windows/lv_windows_context.h
blob: 20e72af370e93fed125f5202d587a0818f98a7a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
 * @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

#include <windows.h>

/*********************
 *      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 {
    CRITICAL_SECTION mutex;
    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*/