refactor: default on state builder
parent
a90f3d80c2
commit
cbcbf2acd9
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue