diff --git a/internal/native/cgo/ctrl.c b/internal/native/cgo/ctrl.c index d8c4cdb2..930b8514 100644 --- a/internal/native/cgo/ctrl.c +++ b/internal/native/cgo/ctrl.c @@ -30,8 +30,17 @@ void jetkvm_set_video_handler(jetkvm_video_handler_t *handler) { video_handler = handler; } +static jetkvm_indev_handler_t *jetkvm_indev_handler = NULL; + +static void jetkvm_indev_wrapper(lv_event_code_t code) { + if (jetkvm_indev_handler != NULL) { + (*jetkvm_indev_handler)((int)code); + } +} + void jetkvm_set_indev_handler(jetkvm_indev_handler_t *handler) { - lvgl_set_indev_handler(handler); + jetkvm_indev_handler = handler; + lvgl_set_indev_handler(jetkvm_indev_wrapper); } void jetkvm_set_rpc_handler(jetkvm_rpc_handler_t *handler) { @@ -45,8 +54,7 @@ void jetkvm_call_rpc_handler(const char *method, const char *params) { } const char *jetkvm_ui_event_code_to_name(int code) { - lv_event_code_t cCode = (lv_event_code_t)code; - return lv_event_code_get_name(code); + return lv_event_code_get_name((lv_event_code_t)code); } void video_report_format(bool ready, const char *error, u_int16_t width, u_int16_t height, double frame_per_second) @@ -386,7 +394,7 @@ char *jetkvm_video_get_edid_hex() { if (edid_len < 0) { return NULL; } - return bytes_to_hex(edid, edid_len); + return (char *)bytes_to_hex(edid, edid_len); } jetkvm_video_state_t *jetkvm_video_get_status() { @@ -394,7 +402,7 @@ jetkvm_video_state_t *jetkvm_video_get_status() { } char *jetkvm_video_log_status() { - return videoc_log_status(); + return (char *)videoc_log_status(); } int jetkvm_video_init() { diff --git a/internal/native/cgo/edid.c b/internal/native/cgo/edid.c index 15160f7b..95dfe95e 100644 --- a/internal/native/cgo/edid.c +++ b/internal/native/cgo/edid.c @@ -117,8 +117,6 @@ const char *videoc_log_status() { int fd; char *buffer = NULL; - size_t buffer_size = 0; - ssize_t bytes_read; fd = open(V4L_SUBDEV, O_RDWR); if (fd < 0) diff --git a/internal/native/cgo/screen.c b/internal/native/cgo/screen.c index 67eb6cc5..844f4c3b 100644 --- a/internal/native/cgo/screen.c +++ b/internal/native/cgo/screen.c @@ -11,8 +11,8 @@ #include "ui_index.h" #include "ctrl.h" -#define DISP_BUF_SIZE (300 * 240 * 2) -static lv_color_t buf[DISP_BUF_SIZE]; +// #define DISP_BUF_SIZE (300 * 240 * 2) +// static lv_color_t buf[DISP_BUF_SIZE]; indev_handler_t *indev_handler = NULL; @@ -97,8 +97,8 @@ void lvgl_set_rotation(lv_display_t *disp, u_int16_t rotation) { } log_info("refreshing objects"); - lv_obj_report_style_change(&flex_screen_style); - lv_obj_report_style_change(&flex_screen_menu_style); + lv_obj_report_style_change(flex_screen_style); + lv_obj_report_style_change(flex_screen_menu_style); } uint32_t custom_tick_get(void) @@ -151,7 +151,7 @@ const char *ui_get_current_screen() { return NULL; } -lv_img_dsc_t *ui_get_image(const char *name) { +const lv_img_dsc_t *ui_get_image(const char *name) { for (size_t i = 0; i < ui_images_size; i++) { if (strcmp(ui_images[i].name, name) == 0) { return ui_images[i].img; diff --git a/internal/native/cgo/screen.h b/internal/native/cgo/screen.h index 4aaabeaf..47e97ede 100644 --- a/internal/native/cgo/screen.h +++ b/internal/native/cgo/screen.h @@ -41,8 +41,15 @@ lv_style_t *ui_get_style(const char *name); * @brief Get the image with the given name * * @param name The name of the image - * @return lv_img_dsc_t* The image with the given name + * @return const lv_img_dsc_t* The image with the given name */ -lv_img_dsc_t *ui_get_image(const char *name); +const lv_img_dsc_t *ui_get_image(const char *name); + +/** + * @brief Get the current screen name + * + * @return const char* The name of the current screen + */ +const char *ui_get_current_screen(); #endif // SCREEN_H diff --git a/internal/native/eez/src/ui/actions.c b/internal/native/eez/src/ui/actions.c index dc30de4d..adf82f0d 100644 --- a/internal/native/eez/src/ui/actions.c +++ b/internal/native/eez/src/ui/actions.c @@ -1,6 +1,7 @@ #include "actions.h" #include "screens.h" #include +#include #include "ui.h" #include "vars.h" @@ -81,7 +82,6 @@ const int REBOOT_HOLD_TIME = 5; void action_reset_config(lv_event_t * e) { lv_event_code_t event_code = lv_event_get_code(e); - lv_obj_t *obj = lv_event_get_target(e); if (event_code == LV_EVENT_PRESSED) { t_reset_config = lv_tick_get(); @@ -112,7 +112,6 @@ void action_reset_config(lv_event_t * e) { void action_reboot(lv_event_t * e) { lv_event_code_t event_code = lv_event_get_code(e); - lv_obj_t *obj = lv_event_get_target(e); if (event_code == LV_EVENT_PRESSED) { t_reboot = lv_tick_get();