v1.2.3: add arg to fix framebuffer not redrawing

on some devices, the framebuffer will not redraw unless something is written to stdout, so the arg 'force-stdout' has been added to write spaces to stdout after every key press or touch event
This commit is contained in:
2025-11-03 00:39:59 +00:00
parent 497beb7bb0
commit c4876e5606
3 changed files with 25 additions and 3 deletions

View File

@@ -107,6 +107,7 @@ fn init(framebuffer: Framebuffer, framebuffer_info: FramebufferInfo) {
});
let touch = args.contains(&"touch".to_string());
let force_stdout = args.contains(&"force-stdout".to_string()); //write to stdout to force framebuffer redraw
//read touchscreen presses (hopefully)
thread::spawn(move || {
@@ -152,10 +153,17 @@ fn init(framebuffer: Framebuffer, framebuffer_info: FramebufferInfo) {
for message in rx {
match message {
ThreadMessage::KeyChar(kc) => wm.handle_message(WindowManagerMessage::KeyChar(kc.clone())),
ThreadMessage::KeyChar(kc) => {
wm.handle_message(WindowManagerMessage::KeyChar(kc.clone()));
if force_stdout {
println!(" "); //without any stdout, on some user's devices, for some reason the framebuffer doesn't get redrawn to the screen
}
},
ThreadMessage::Touch(x, y) => {
wm.handle_message(WindowManagerMessage::Touch(x, y));
println!(" "); //without any stdout, on my phone, for some reason the framebuffer doesn't get redrawn to the screen
if force_stdout {
println!(" "); //without any stdout, on my phone, for some reason the framebuffer doesn't get redrawn to the screen
}
},
ThreadMessage::Clear => {
write!(stdout.stdout, "{}", CLEAR_ALL).unwrap();