| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- From 11f311332ab8307607884ce176d2b8ac05a623a9 Mon Sep 17 00:00:00 2001
- From: Stefano Babic <stefano.babic@swupdate.org>
- Date: Fri, 23 Oct 2026 13:59:43 +0200
- Subject: [PATCH] lv: build with LVGL 9.2
- LVGL 9.2 declares lv_state_t as uint16_t, while bindgen emits the
- LV_STATE_* values as u32. Accept any integer convertible to u32 in the
- state helpers and cast it to lv_state_t.
- lv_slider_set_value() takes an lv_anim_enable_t up to 9.2 and a bool
- in later versions: pass the default value, that is "animation off"
- for both.
- Upstream-Status: Pending
- Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
- ---
- src/lv.rs | 17 ++++++++++-------
- 1 file changed, 10 insertions(+), 7 deletions(-)
- diff --git a/src/lv.rs b/src/lv.rs
- index 55d7fe3..6eb41e0 100644
- --- a/src/lv.rs
- +++ b/src/lv.rs
- @@ -215,16 +215,17 @@ impl Obj {
- self.remove_flag(sys::LV_OBJ_FLAG_SCROLLABLE);
- }
-
- - pub fn add_state(self, state: sys::lv_state_t) {
- - unsafe { sys::lv_obj_add_state(self.raw(), state) }
- + /* LVGL 9.2: lv_state_t is u16 but bindgen emits the LV_STATE_* values as u32 */
- + pub fn add_state(self, state: impl Into<u32>) {
- + unsafe { sys::lv_obj_add_state(self.raw(), state.into() as sys::lv_state_t) }
- }
-
- - pub fn remove_state(self, state: sys::lv_state_t) {
- - unsafe { sys::lv_obj_remove_state(self.raw(), state) }
- + pub fn remove_state(self, state: impl Into<u32>) {
- + unsafe { sys::lv_obj_remove_state(self.raw(), state.into() as sys::lv_state_t) }
- }
-
- - pub fn has_state(self, state: sys::lv_state_t) -> bool {
- - unsafe { sys::lv_obj_has_state(self.raw(), state) }
- + pub fn has_state(self, state: impl Into<u32>) -> bool {
- + unsafe { sys::lv_obj_has_state(self.raw(), state.into() as sys::lv_state_t) }
- }
-
- /* styles */
- @@ -292,8 +293,10 @@ impl Obj {
-
- /* slider */
-
- + /* The animation flag is lv_anim_enable_t up to LVGL 9.2 and bool later:
- + * the default value is "off" for both */
- pub fn slider_set_value(self, value: i32) {
- - unsafe { sys::lv_slider_set_value(self.raw(), value, false) }
- + unsafe { sys::lv_slider_set_value(self.raw(), value, Default::default()) }
- }
-
- /* text area */
- --
- 2.53.0
|