refactor: remove unnecessary unwraps
parent
3f499429d7
commit
f310825194
|
@ -30,6 +30,7 @@ pedantic = { level = "warn", priority = -1 }
|
||||||
clone_on_ref_ptr = "warn"
|
clone_on_ref_ptr = "warn"
|
||||||
multiple-crate-versions = "allow"
|
multiple-crate-versions = "allow"
|
||||||
module_name_repetitions = "allow"
|
module_name_repetitions = "allow"
|
||||||
|
unwrap_used = "warn"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
|
|
|
@ -56,7 +56,12 @@ impl WindowingSystem {
|
||||||
let pointer = Rc::new(seat.get_pointer(&event_queue.handle(), ()));
|
let pointer = Rc::new(seat.get_pointer(&event_queue.handle(), ()));
|
||||||
|
|
||||||
let mut state_builder = WindowStateBuilder::new()
|
let mut state_builder = WindowStateBuilder::new()
|
||||||
.component_definition(config.component_definition.take().unwrap())
|
.component_definition(
|
||||||
|
config
|
||||||
|
.component_definition
|
||||||
|
.take()
|
||||||
|
.context("Component definition is required")?,
|
||||||
|
)
|
||||||
.surface(Rc::clone(&surface))
|
.surface(Rc::clone(&surface))
|
||||||
.layer_surface(Rc::clone(&layer_surface))
|
.layer_surface(Rc::clone(&layer_surface))
|
||||||
.pointer(Rc::clone(&pointer))
|
.pointer(Rc::clone(&pointer))
|
||||||
|
@ -218,7 +223,7 @@ impl WindowingSystem {
|
||||||
.read()
|
.read()
|
||||||
.map_err(|e| anyhow::anyhow!("Failed to read events: {}", e))?;
|
.map_err(|e| anyhow::anyhow!("Failed to read events: {}", e))?;
|
||||||
}
|
}
|
||||||
connection.flush().unwrap();
|
connection.flush()?;
|
||||||
|
|
||||||
event_queue.dispatch_pending(shared_data)?;
|
event_queue.dispatch_pending(shared_data)?;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use slint_interpreter::ComponentDefinition;
|
||||||
use smithay_client_toolkit::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_surface_v1::ZwlrLayerSurfaceV1;
|
use smithay_client_toolkit::reexports::protocols_wlr::layer_shell::v1::client::zwlr_layer_surface_v1::ZwlrLayerSurfaceV1;
|
||||||
use wayland_client::protocol::{wl_pointer::WlPointer, wl_surface::WlSurface};
|
use wayland_client::protocol::{wl_pointer::WlPointer, wl_surface::WlSurface};
|
||||||
use crate::rendering::{femtovg_window::FemtoVGWindow, slint_platform::CustomSlintPlatform};
|
use crate::rendering::{femtovg_window::FemtoVGWindow, slint_platform::CustomSlintPlatform};
|
||||||
use anyhow::Result;
|
use anyhow::{Context, Result};
|
||||||
|
|
||||||
use super::WindowState;
|
use super::WindowState;
|
||||||
|
|
||||||
|
@ -77,7 +77,9 @@ impl WindowStateBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(self) -> Result<WindowState> {
|
pub fn build(self) -> Result<WindowState> {
|
||||||
let platform = CustomSlintPlatform::new(Rc::clone(self.window.as_ref().unwrap()));
|
let platform = CustomSlintPlatform::new(Rc::clone(
|
||||||
|
self.window.as_ref().context("Window is required")?,
|
||||||
|
));
|
||||||
slint::platform::set_platform(Box::new(platform))
|
slint::platform::set_platform(Box::new(platform))
|
||||||
.map_err(|e| anyhow::anyhow!("Failed to set platform: {:?}", e))?;
|
.map_err(|e| anyhow::anyhow!("Failed to set platform: {:?}", e))?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue