Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
507f419
Refactor split_host_port function for improved readability and effici…
AlixANNERAUD May 27, 2026
ba76ac1
Refactor render_cpuinfo_text function for improved readability
AlixANNERAUD May 27, 2026
f565e11
Enable private API usage in lv_conf.h
AlixANNERAUD May 27, 2026
9616e4b
Refactor Window structure and event handling for improved clarity and…
AlixANNERAUD May 27, 2026
b078583
Refactor Manager to use OwnedWindow and improve window handling
AlixANNERAUD May 27, 2026
e1d0494
Refactor graphics window handling to use OwnedWindow for improved con…
AlixANNERAUD May 27, 2026
1e36f48
Refactor command resolution logic for improved readability and consis…
AlixANNERAUD May 27, 2026
15a181d
Refactor graphics window handling to use NonNull for improved safety …
AlixANNERAUD May 27, 2026
136892e
Refactor format functions to simplify data handling and improve reada…
AlixANNERAUD May 27, 2026
0f9a069
Refactor clipboard event handling in KeyboardDevice for improved read…
AlixANNERAUD May 27, 2026
2df3ff1
Refactor clipboard event handling in KeyboardDevice for improved clar…
AlixANNERAUD May 27, 2026
27e8f93
Refactor window module to improve memory handling and simplify icon t…
AlixANNERAUD May 27, 2026
45508e7
Refactor find_first_available_identifier to simplify range handling a…
AlixANNERAUD May 27, 2026
558ab55
Refactor unmount logic in VirtualFileSystem to improve clarity and ef…
AlixANNERAUD May 27, 2026
0c45847
Refactor error handling and improve readability in https_get function
AlixANNERAUD May 27, 2026
1f3f62f
Refactor MBR reading logic to simplify device reference handling
AlixANNERAUD May 27, 2026
ac51499
Refactor generate_code function to simplify function call handling
AlixANNERAUD May 27, 2026
2f268bf
Refactor window creation in graphics test to use mutable object refer…
AlixANNERAUD May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions drivers/shared/src/devices/http_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,24 @@ pub fn map_network_error(error: network::Error) -> Error {
}

pub fn split_host_port(host_value: &str, default_port: u16) -> (&str, u16) {
if let Some(stripped) = host_value.strip_prefix('[') {
if let Some(end) = stripped.find(']') {
let host = &stripped[..end];
let remainder = &stripped[end + 1..];
if let Some(port_string) = remainder.strip_prefix(':') {
if let Ok(port) = port_string.parse::<u16>() {
return (host, port);
}
}
return (host, default_port);
if let Some(stripped) = host_value.strip_prefix('[')
&& let Some(end) = stripped.find(']')
{
let host = &stripped[..end];
let remainder = &stripped[end + 1..];
if let Some(port_string) = remainder.strip_prefix(':')
&& let Ok(port) = port_string.parse::<u16>()
{
return (host, port);
}
return (host, default_port);
}

if let Some((host, port_string)) = host_value.rsplit_once(':') {
if !host.contains(':') {
if let Ok(port) = port_string.parse::<u16>() {
return (host, port);
}
}
if let Some((host, port_string)) = host_value.rsplit_once(':')
&& !host.contains(':')
&& let Ok(port) = port_string.parse::<u16>()
{
return (host, port);
}

(host_value, default_port)
Expand Down
8 changes: 4 additions & 4 deletions drivers/std/src/devices/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ fn render_cpuinfo_text() -> String {
let architecture = std::env::consts::ARCH;
let cores = std::thread::available_parallelism().ok().map(usize::from);

if cfg!(target_os = "linux") {
if let Ok(content) = std::fs::read_to_string("/proc/cpuinfo") {
return build_cpuinfo_text_from_proc(&content, architecture, cores);
}
if cfg!(target_os = "linux")
&& let Ok(content) = std::fs::read_to_string("/proc/cpuinfo")
{
return build_cpuinfo_text_from_proc(&content, architecture, cores);
}

build_cpuinfo_text_from_proc("", architecture, cores)
Expand Down
12 changes: 6 additions & 6 deletions drivers/wasm/src/devices/graphics/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ impl KeyboardDevice {
let sender = inner.0.sender();

let paste_closure = Closure::wrap(Box::new(move |event: ClipboardEvent| {
if let Some(clipboard_data) = event.clipboard_data() {
if let Ok(text) = clipboard_data.get_data("text") {
for char in text.chars() {
Self::handle_key_press_char(sender, char, true);
Self::handle_key_press_char(sender, char, false);
}
if let Some(clipboard_data) = event.clipboard_data()
&& let Ok(text) = clipboard_data.get_data("text")
{
for char in text.chars() {
Self::handle_key_press_char(sender, char, true);
Self::handle_key_press_char(sender, char, false);
}
}
}) as Box<dyn FnMut(ClipboardEvent)>);
Expand Down
4 changes: 2 additions & 2 deletions drivers/wasm/src/devices/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn build_request<'a>(scheme: &str, request: HttpRequestParser<'a>) -> Option<Req

let url = format!("{}://{}{}", scheme, host?, path.unwrap_or("/"));

Some(Request::new_with_str_and_init(&url, &options).ok()?)
Request::new_with_str_and_init(&url, &options).ok()
}

fn build_headers_response(response: &web_sys::Response, buffer: &mut [u8]) -> Result<usize> {
Expand All @@ -78,7 +78,7 @@ fn build_headers_response(response: &web_sys::Response, buffer: &mut [u8]) -> Re
// Status code
let status = response.status();
builder
.add_status_code(status as u16)
.add_status_code(status)
.ok_or(Error::InternalError)?;

// Headers
Expand Down
2 changes: 1 addition & 1 deletion drivers/wasm/src/devices/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl DirectBaseOperations for TimeDevice {

buffer[..duration_bytes.len()].copy_from_slice(duration_bytes);

Ok(duration_bytes.len().into())
Ok(duration_bytes.len())
}

fn write(&self, _: &[u8], _: Size) -> Result<usize> {
Expand Down
2 changes: 1 addition & 1 deletion examples/wasm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn main() {
let partition = Box::leak(Box::new(partition));

// Print MBR information
let mbr = Mbr::read_from_device(&*drive).unwrap();
let mbr = Mbr::read_from_device(drive).unwrap();
log::information!("MBR Information: {mbr}");

// Mount the file system
Expand Down
24 changes: 12 additions & 12 deletions executables/file_manager/src/file_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ pub(crate) use alloc::{
vec::Vec,
};
use core::ptr::null_mut;
use xila::internationalization::translate;
use xila::log;
use xila::task;
use xila::virtual_file_system::{Directory, get_instance};
use xila::{
file_system::{Kind, Path, PathOwned},
graphics::{
self, EventKind, Window, lvgl,
self, EventKind, lvgl,
palette::{self, Hue},
},
};
use xila::{graphics::OwnedWindow, internationalization::translate};

pub struct FileManager {
window: Window,
window: OwnedWindow,
toolbar: *mut lvgl::lv_obj_t,
up_button: *mut lvgl::lv_obj_t,
home_button: *mut lvgl::lv_obj_t,
Expand Down Expand Up @@ -63,15 +63,15 @@ impl FileManager {
// Set up window layout for flex
unsafe {
lvgl::lv_obj_set_layout(
manager.window.get_object(),
manager.window.as_object_mutable(),
lvgl::lv_layout_t_LV_LAYOUT_FLEX,
);
lvgl::lv_obj_set_flex_flow(
manager.window.get_object(),
manager.window.as_object_mutable(),
lvgl::lv_flex_flow_t_LV_FLEX_FLOW_COLUMN,
);
lvgl::lv_obj_set_style_pad_all(
manager.window.get_object(),
manager.window.as_object_mutable(),
0,
lvgl::LV_STATE_DEFAULT,
);
Expand Down Expand Up @@ -103,10 +103,10 @@ impl FileManager {

pub async fn handle_event(&mut self, event: graphics::Event) -> Result<()> {
match event.code {
EventKind::Delete | EventKind::CloseRequested => {
if event.target == self.window.get_object() {
self.running = false;
}
EventKind::Delete | EventKind::CloseRequested
if event.target == self.window.as_object_mutable() =>
{
self.running = false;
}
EventKind::Clicked => {
let target = event.target;
Expand All @@ -133,7 +133,7 @@ impl FileManager {

async fn create_toolbar(&mut self) -> Result<()> {
unsafe {
self.toolbar = lvgl::lv_obj_create(self.window.get_object());
self.toolbar = lvgl::lv_obj_create(self.window.as_object_mutable());
if self.toolbar.is_null() {
return Err(Error::FailedToCreateObject);
}
Expand Down Expand Up @@ -223,7 +223,7 @@ impl FileManager {

async fn create_file_list(&mut self) -> Result<()> {
unsafe {
self.file_list = lvgl::lv_list_create(self.window.get_object());
self.file_list = lvgl::lv_list_create(self.window.as_object_mutable());
if self.file_list.is_null() {
return Err(Error::FailedToCreateObject);
}
Expand Down
9 changes: 5 additions & 4 deletions executables/settings/src/settings.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use alloc::string::String;
use xila::file_system::Kind;
use xila::graphics::OwnedWindow;
use xila::graphics::{
self, EventKind, Window, lvgl,
self, EventKind, lvgl,
palette::{self, Hue},
};

use crate::error::Result;
use crate::tabs::{AboutTab, GeneralTab, NetworkTab, PasswordTab, Tab};

pub struct Settings {
window: Window,
window: OwnedWindow,
tabs: [Tab; 4],
}

Expand All @@ -30,7 +31,7 @@ impl Settings {

// Create tabview
let tabview = unsafe {
let tabview = lvgl::lv_tabview_create(window.get_object());
let tabview = lvgl::lv_tabview_create(window.as_object_mutable());

if tabview.is_null() {
return Err(crate::error::Error::FailedToCreateUiElement);
Expand Down Expand Up @@ -60,7 +61,7 @@ impl Settings {
while let Some(event) = self.window.pop_event() {
// Logique de filtrage spécifique à Settings
if (event.code == EventKind::Delete || event.code == EventKind::CloseRequested)
&& event.target == self.window.get_object()
&& event.target == self.window.as_object_mutable()
{
return false;
}
Expand Down
14 changes: 6 additions & 8 deletions executables/shell/command_line/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ impl Shell {
None => return Ok(()),
};

let result = match next_positional {
command => match resolve_user_command(command) {
Some(user_command) => {
let mut context = ShellCommandContext::new(self);
dispatch_user_command(user_command, &mut context, &mut options, paths).await
}
None => self.execute(input, paths).await,
},
let result = match resolve_user_command(next_positional) {
Some(user_command) => {
let mut context = ShellCommandContext::new(self);
dispatch_user_command(user_command, &mut context, &mut options, paths).await
}
None => self.execute(input, paths).await,
};

if let Err(error) = result {
Expand Down
Loading
Loading