Skip to content

Commit 365a419

Browse files
committed
chore: add LV_STATE_DISABLED to obj set state
1 parent 6a4dfca commit 365a419

File tree

4 files changed

+263
-326
lines changed

4 files changed

+263
-326
lines changed

internal/native/cgo/ctrl.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "edid.h"
1313
#include "ctrl.h"
1414
#include <lvgl.h>
15+
#include "ui/vars.h"
1516
#include "log.h"
1617
#include "log_handler.h"
1718

@@ -158,6 +159,10 @@ lv_obj_flag_t str_to_lv_obj_flag(const char *flag)
158159
}
159160
}
160161

162+
void jetkvm_set_app_version(const char *version) {
163+
set_var_app_version(version);
164+
}
165+
161166
void jetkvm_ui_init() {
162167
lvgl_init();
163168
}
@@ -237,7 +242,20 @@ void jetkvm_ui_set_state(const char *obj_name, const char *state_name) {
237242
{
238243
state_val = LV_STATE_USER_2;
239244
}
240-
lv_obj_clear_state(obj, LV_STATE_USER_1 | LV_STATE_USER_2);
245+
else if (strcmp(state_name, "LV_STATE_USER_3") == 0)
246+
{
247+
state_val = LV_STATE_USER_3;
248+
}
249+
else if (strcmp(state_name, "LV_STATE_USER_4") == 0)
250+
{
251+
state_val = LV_STATE_USER_4;
252+
}
253+
else if (strcmp(state_name, "LV_STATE_DISABLED") == 0)
254+
{
255+
state_val = LV_STATE_DISABLED;
256+
}
257+
// TODO: use LV_STATE_USER_* once eez supports it
258+
lv_obj_clear_state(obj, LV_STATE_USER_1 | LV_STATE_USER_2 | LV_STATE_USER_3 | LV_STATE_USER_4 | LV_STATE_DISABLED);
241259
lv_obj_add_state(obj, state_val);
242260
}
243261

internal/native/cgo/ctrl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ typedef void (jetkvm_video_handler_t)(const uint8_t *frame, ssize_t len);
2222
void jetkvm_set_log_handler(jetkvm_log_handler_t *handler);
2323
void jetkvm_set_video_handler(jetkvm_video_handler_t *handler);
2424

25+
void jetkvm_set_app_version(const char *version);
26+
2527
void jetkvm_ui_init();
2628
void jetkvm_ui_tick();
2729

0 commit comments

Comments
 (0)