refactor: default on state builder
parent
a90f3d80c2
commit
cbcbf2acd9
|
@ -16,7 +16,7 @@ use smithay_client_toolkit::reexports::{
|
||||||
use state::builder::WindowStateBuilder;
|
use state::builder::WindowStateBuilder;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use wayland_client::{
|
use wayland_client::{
|
||||||
globals::{registry_queue_init, GlobalList},
|
globals::registry_queue_init,
|
||||||
protocol::{
|
protocol::{
|
||||||
wl_compositor::WlCompositor, wl_display::WlDisplay, wl_output::WlOutput, wl_seat::WlSeat,
|
wl_compositor::WlCompositor, wl_display::WlDisplay, wl_output::WlOutput, wl_seat::WlSeat,
|
||||||
wl_surface::WlSurface,
|
wl_surface::WlSurface,
|
||||||
|
|
|
@ -8,7 +8,6 @@ use anyhow::Result;
|
||||||
|
|
||||||
use super::WindowState;
|
use super::WindowState;
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct WindowStateBuilder {
|
pub struct WindowStateBuilder {
|
||||||
pub component_definition: Option<ComponentDefinition>,
|
pub component_definition: Option<ComponentDefinition>,
|
||||||
pub surface: Option<Rc<WlSurface>>,
|
pub surface: Option<Rc<WlSurface>>,
|
||||||
|
@ -23,19 +22,8 @@ pub struct WindowStateBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WindowStateBuilder {
|
impl WindowStateBuilder {
|
||||||
pub const fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Default::default()
|
||||||
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 surface(mut self, surface: Rc<WlSurface>) -> Self {
|
pub fn surface(mut self, surface: Rc<WlSurface>) -> Self {
|
||||||
|
@ -96,3 +84,20 @@ impl WindowStateBuilder {
|
||||||
WindowState::new(self)
|
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