fix(display): Port modifiers widget to Zephyr 3.2/LVGL 8
This commit is contained in:
parent
4d83fc2cde
commit
467ff20ea3
3 changed files with 8 additions and 12 deletions
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
#include <kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
|
||||||
struct zmk_widget_mods_status {
|
struct zmk_widget_mods_status {
|
||||||
sys_snode_t node;
|
sys_snode_t node;
|
||||||
|
|
|
@ -73,11 +73,9 @@ lv_obj_t *zmk_display_status_screen() {
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_ZMK_WIDGET_MODS_STATUS)
|
#if IS_ENABLED(CONFIG_ZMK_WIDGET_MODS_STATUS)
|
||||||
zmk_widget_mods_status_init(&mods_status_widget, screen);
|
zmk_widget_mods_status_init(&mods_status_widget, screen);
|
||||||
lv_obj_set_style_local_text_font(zmk_widget_mods_status_obj(&mods_status_widget),
|
lv_obj_set_style_text_font(zmk_widget_mods_status_obj(&mods_status_widget),
|
||||||
LV_LABEL_PART_MAIN, LV_STATE_DEFAULT,
|
lv_theme_get_font_small(screen), LV_PART_MAIN);
|
||||||
lv_theme_get_font_small());
|
lv_obj_align(zmk_widget_mods_status_obj(&mods_status_widget), LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||||
lv_obj_align(zmk_widget_mods_status_obj(&mods_status_widget), NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0,
|
|
||||||
0);
|
|
||||||
#endif
|
#endif
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||||
|
|
||||||
#include <zmk/display.h>
|
#include <zmk/display.h>
|
||||||
|
@ -38,7 +38,7 @@ void set_mods_symbol(lv_obj_t *label, struct mods_status_state state) {
|
||||||
strcat(text, "G");
|
strcat(text, "G");
|
||||||
|
|
||||||
lv_label_set_text(label, text);
|
lv_label_set_text(label, text);
|
||||||
lv_obj_align(label, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -1, 0);
|
lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, -1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mods_status_update_cb(struct mods_status_state state) {
|
void mods_status_update_cb(struct mods_status_state state) {
|
||||||
|
@ -51,10 +51,8 @@ ZMK_DISPLAY_WIDGET_LISTENER(widget_mods_status, struct mods_status_state, mods_s
|
||||||
ZMK_SUBSCRIPTION(widget_mods_status, zmk_keycode_state_changed);
|
ZMK_SUBSCRIPTION(widget_mods_status, zmk_keycode_state_changed);
|
||||||
|
|
||||||
int zmk_widget_mods_status_init(struct zmk_widget_mods_status *widget, lv_obj_t *parent) {
|
int zmk_widget_mods_status_init(struct zmk_widget_mods_status *widget, lv_obj_t *parent) {
|
||||||
widget->obj = lv_label_create(parent, NULL);
|
widget->obj = lv_label_create(parent);
|
||||||
lv_label_set_align(widget->obj, LV_LABEL_ALIGN_RIGHT);
|
lv_obj_set_style_text_align(widget->obj, LV_TEXT_ALIGN_RIGHT, 0);
|
||||||
|
|
||||||
lv_obj_set_size(widget->obj, 40, 15);
|
|
||||||
|
|
||||||
sys_slist_append(&widgets, &widget->node);
|
sys_slist_append(&widgets, &widget->node);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue