mirror of
https://codeberg.org/waydeer/layer-shika.git
synced 2025-10-28 14:14:23 +00:00
fix: request initial redraw to ensure the first frame is rendered
This commit is contained in:
parent
06f1f8c420
commit
561f51c15b
1 changed files with 8 additions and 3 deletions
|
|
@ -29,12 +29,19 @@ impl WindowState {
|
||||||
let component_definition = builder.component_definition.ok_or_else(|| {
|
let component_definition = builder.component_definition.ok_or_else(|| {
|
||||||
LayerShikaError::InvalidInput("Component definition is required".into())
|
LayerShikaError::InvalidInput("Component definition is required".into())
|
||||||
})?;
|
})?;
|
||||||
|
let window = builder
|
||||||
|
.window
|
||||||
|
.ok_or_else(|| LayerShikaError::InvalidInput("Window is required".into()))?;
|
||||||
let component_instance = component_definition
|
let component_instance = component_definition
|
||||||
.create()
|
.create()
|
||||||
.map_err(|e| LayerShikaError::SlintComponentCreation(e.to_string()))?;
|
.map_err(|e| LayerShikaError::SlintComponentCreation(e.to_string()))?;
|
||||||
component_instance
|
component_instance
|
||||||
.show()
|
.show()
|
||||||
.map_err(|e| LayerShikaError::SlintComponentCreation(e.to_string()))?;
|
.map_err(|e| LayerShikaError::SlintComponentCreation(e.to_string()))?;
|
||||||
|
|
||||||
|
// Request initial redraw to ensure the first frame is rendered
|
||||||
|
window.request_redraw();
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
component_instance,
|
component_instance,
|
||||||
surface: builder
|
surface: builder
|
||||||
|
|
@ -45,9 +52,7 @@ impl WindowState {
|
||||||
.ok_or_else(|| LayerShikaError::InvalidInput("Layer surface is required".into()))?,
|
.ok_or_else(|| LayerShikaError::InvalidInput("Layer surface is required".into()))?,
|
||||||
size: builder.size.unwrap_or_default(),
|
size: builder.size.unwrap_or_default(),
|
||||||
output_size: builder.output_size.unwrap_or_default(),
|
output_size: builder.output_size.unwrap_or_default(),
|
||||||
window: builder
|
window,
|
||||||
.window
|
|
||||||
.ok_or_else(|| LayerShikaError::InvalidInput("Window is required".into()))?,
|
|
||||||
current_pointer_position: LogicalPosition::default(),
|
current_pointer_position: LogicalPosition::default(),
|
||||||
scale_factor: builder.scale_factor,
|
scale_factor: builder.scale_factor,
|
||||||
height: builder.height,
|
height: builder.height,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue