Rendering tested and working
This commit is contained in:
@@ -214,6 +214,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
upower::spawn_upower(reporter)?;
|
upower::spawn_upower(reporter)?;
|
||||||
|
// upower::spawn_mock(reporter)?;
|
||||||
channel
|
channel
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -242,6 +243,8 @@ fn main() -> anyhow::Result<()> {
|
|||||||
info.id,
|
info.id,
|
||||||
Surface::new(&output, surface, &layer_shell.clone(), pool, &app_state_handle),
|
Surface::new(&output, surface, &layer_shell.clone(), pool, &app_state_handle),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
output.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,27 @@ macro_rules! catch {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn spawn_mock(reporter: PowerReporter) -> anyhow::Result<()> {
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
*reporter.status.write().unwrap() = Some(PowerState{
|
||||||
|
level: 0.0,
|
||||||
|
charging: false,
|
||||||
|
time_remaining: 0.0,
|
||||||
|
});
|
||||||
|
let mut fill = 0u32;
|
||||||
|
loop {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||||
|
{
|
||||||
|
let mut lock = reporter.status.write().unwrap();
|
||||||
|
fill = (fill + 1) & 0x1FF;
|
||||||
|
lock.as_mut().unwrap().level = (fill as f32) / 512.0f32;
|
||||||
|
};
|
||||||
|
reporter.sender.send(()).unwrap();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn spawn_upower(reporter: PowerReporter) -> anyhow::Result<()> {
|
pub fn spawn_upower(reporter: PowerReporter) -> anyhow::Result<()> {
|
||||||
let (start_send, start_receive) = std::sync::mpsc::sync_channel(1);
|
let (start_send, start_receive) = std::sync::mpsc::sync_channel(1);
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
|||||||
Reference in New Issue
Block a user