Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My text() os not updated when clicking Theo button in FydeOS 18.0 #2349

Closed
2 tasks done
soucosmo opened this issue Mar 23, 2024 · 3 comments
Closed
2 tasks done

My text() os not updated when clicking Theo button in FydeOS 18.0 #2349

soucosmo opened this issue Mar 23, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@soucosmo
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

My main.rs

use iced::{
    Element,
    Sandbox,
    Settings,
    widget::{button, column, text, Column},
};

#[derive(Debug, Clone)]
enum Contagem {
    Adc1,
    Adc10,
    Rem1,
    Rem10,
}


pub fn main() -> iced::Result {
    App::run(Settings::default())
}

#[derive(Default)]
struct App {
    contagem: i32,
}

impl Sandbox for App {
    type Message = Contagem;

    fn new() -> Self {
        Self { contagem: 0 }
    }

    fn title(&self) -> String {
        String::from("A cool application")
    }

    fn update(&mut self, message: Self::Message) {
        println!("contagem {}", self.contagem);
        match message {
            Contagem::Adc1 => self.contagem += 1,
            Contagem::Adc10 => self.contagem += 10,
            Contagem::Rem1 => self.contagem -= 1,
            Contagem::Rem10 => self.contagem -= 10,
        }
    
    }

    fn view(&self) -> Element<Self::Message> {
        println!("contagem view {}", self.contagem);

        column![
            text("Hello, world!").size(45),
            button("Adicionar 1").on_press(Contagem::Adc1),
            button("Adicionar 10").on_press(Contagem::Adc10),
            text(&self.contagem).size(25),
            button("Remover 1").on_press(Contagem::Rem1),
            button("Remover 10").on_press(Contagem::Rem10),
        ].into()
    }
}

My Cargo.toml

[package]
name = "teste-iced"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
iced = { version = "0.12.1", features = ["tokio", "webgl"] }
iced_runtime = "0.12.1"

When running the program, everything works fine, except updating text(&self.contagem).size(25), when clicking the button, nothing happens, does anyone know how to solve it?

What is the expected behavior?

When clicking on a button, the counter should show the updated value on the screen, the view() function is called normally, the print happens to prove it, the code works on another computer with Windows, but on my operating system it doesn't work, I'm using it FydeOS 18.0

Version

crates.io release

Operating System

Linux

Do you have any log output?

No response

@soucosmo soucosmo added the bug Something isn't working label Mar 23, 2024
@soucosmo
Copy link
Author

Screenshot

image

The console indicates that the buttons work, but the interface is not updated according to the self.contagem value

@soucosmo
Copy link
Author

I managed to solve it by setting this environment variable: ICED_BACKEND=tiny-skia
image

@soucosmo soucosmo closed this as completed Apr 3, 2024
@soucosmo
Copy link
Author

soucosmo commented Apr 3, 2024

One thing I noticed is that ICED_BACKEND=tiny-skia makes the performance poor, I built a list, and when adding new items to the list it is possible to notice the delay in updating.

Researching more on the subject, I found this link pop-os/cosmic-comp#264 which suggests using WGPU_BACKEND=gl, and to my surprise, the performance was perfect, I don't know if that works of something in the development of iced, but here is my story.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant