chore: more coherent builder methods naming with other one

WIP/draft
drendog 2024-08-21 01:52:54 +02:00
parent ec37a1afc6
commit 1c62222f2f
Signed by: dwenya
GPG Key ID: 8DD77074645332D0
2 changed files with 18 additions and 18 deletions

View File

@ -61,14 +61,14 @@ impl WindowingSystem {
.context("Component definition is required")?;
let state = WindowStateBuilder::new()
.component_definition(component_definition)
.surface(Rc::clone(&surface))
.layer_surface(Rc::clone(&layer_surface))
.pointer(Rc::clone(&pointer))
.scale_factor(config.scale_factor)
.height(config.height)
.exclusive_zone(config.exclusive_zone)
.window(window)
.with_component_definition(component_definition)
.with_surface(Rc::clone(&surface))
.with_layer_surface(Rc::clone(&layer_surface))
.with_pointer(Rc::clone(&pointer))
.with_scale_factor(config.scale_factor)
.with_height(config.height)
.with_exclusive_zone(config.exclusive_zone)
.with_window(window)
.build()?;
let event_loop = EventLoop::try_new().context("Failed to create event loop")?;

View File

@ -26,52 +26,52 @@ impl WindowStateBuilder {
Self::default()
}
pub fn surface(mut self, surface: Rc<WlSurface>) -> Self {
pub fn with_surface(mut self, surface: Rc<WlSurface>) -> Self {
self.surface = Some(surface);
self
}
pub fn layer_surface(mut self, layer_surface: Rc<ZwlrLayerSurfaceV1>) -> Self {
pub fn with_layer_surface(mut self, layer_surface: Rc<ZwlrLayerSurfaceV1>) -> Self {
self.layer_surface = Some(layer_surface);
self
}
pub const fn size(mut self, size: PhysicalSize) -> Self {
pub const fn with_size(mut self, size: PhysicalSize) -> Self {
self.size = Some(size);
self
}
pub const fn output_size(mut self, output_size: PhysicalSize) -> Self {
pub const fn with_output_size(mut self, output_size: PhysicalSize) -> Self {
self.output_size = Some(output_size);
self
}
pub fn pointer(mut self, pointer: Rc<WlPointer>) -> Self {
pub fn with_pointer(mut self, pointer: Rc<WlPointer>) -> Self {
self.pointer = Some(pointer);
self
}
pub fn window(mut self, window: Rc<FemtoVGWindow>) -> Self {
pub fn with_window(mut self, window: Rc<FemtoVGWindow>) -> Self {
self.window = Some(window);
self
}
pub const fn scale_factor(mut self, scale_factor: f32) -> Self {
pub const fn with_scale_factor(mut self, scale_factor: f32) -> Self {
self.scale_factor = scale_factor;
self
}
pub const fn height(mut self, height: u32) -> Self {
pub const fn with_height(mut self, height: u32) -> Self {
self.height = height;
self
}
pub const fn exclusive_zone(mut self, exclusive_zone: i32) -> Self {
pub const fn with_exclusive_zone(mut self, exclusive_zone: i32) -> Self {
self.exclusive_zone = exclusive_zone;
self
}
pub fn component_definition(mut self, component_definition: ComponentDefinition) -> Self {
pub fn with_component_definition(mut self, component_definition: ComponentDefinition) -> Self {
self.component_definition = Some(component_definition);
self
}