refactor: default on state builder

WIP/draft
drendog 2024-08-20 23:43:33 +02:00
parent a90f3d80c2
commit cbcbf2acd9
Signed by: dwenya
GPG Key ID: 8DD77074645332D0
2 changed files with 20 additions and 15 deletions

View File

@ -16,7 +16,7 @@ use smithay_client_toolkit::reexports::{
use state::builder::WindowStateBuilder;
use std::rc::Rc;
use wayland_client::{
globals::{registry_queue_init, GlobalList},
globals::registry_queue_init,
protocol::{
wl_compositor::WlCompositor, wl_display::WlDisplay, wl_output::WlOutput, wl_seat::WlSeat,
wl_surface::WlSurface,

View File

@ -8,7 +8,6 @@ use anyhow::Result;
use super::WindowState;
#[derive(Clone)]
pub struct WindowStateBuilder {
pub component_definition: Option<ComponentDefinition>,
pub surface: Option<Rc<WlSurface>>,
@ -23,19 +22,8 @@ pub struct WindowStateBuilder {
}
impl WindowStateBuilder {
pub const fn new() -> Self {
Self {
component_definition: None,
surface: None,
layer_surface: None,
size: None,
output_size: None,
pointer: None,
window: None,
scale_factor: 1.0,
height: 30,
exclusive_zone: -1,
}
pub fn new() -> Self {
Default::default()
}
pub fn surface(mut self, surface: Rc<WlSurface>) -> Self {
@ -96,3 +84,20 @@ impl WindowStateBuilder {
WindowState::new(self)
}
}
impl Default for WindowStateBuilder {
fn default() -> Self {
Self {
component_definition: None,
surface: None,
layer_surface: None,
size: None,
output_size: None,
pointer: None,
window: None,
scale_factor: 1.0,
height: 30,
exclusive_zone: -1,
}
}
}