feat(wayland): make state fields optional
This commit is contained in:
@@ -71,11 +71,11 @@ pub struct ToplevelState {
|
||||
pub mapped: bool,
|
||||
#[serde(skip_serializing)]
|
||||
pub parent: Option<WlWeak<XdgToplevel>>,
|
||||
pub title: String,
|
||||
pub app_id: String,
|
||||
pub title: Option<String>,
|
||||
pub app_id: Option<String>,
|
||||
pub size: Vector2<u32>,
|
||||
pub max_size: Vector2<u32>,
|
||||
pub min_size: Vector2<u32>,
|
||||
pub max_size: Option<Vector2<u32>>,
|
||||
pub min_size: Option<Vector2<u32>>,
|
||||
pub states: Vec<u8>,
|
||||
#[serde(skip_serializing)]
|
||||
pub queued_state: Option<Box<ToplevelState>>,
|
||||
@@ -85,11 +85,11 @@ impl Default for ToplevelState {
|
||||
Self {
|
||||
mapped: false,
|
||||
parent: None,
|
||||
title: String::default(),
|
||||
app_id: String::default(),
|
||||
title: None,
|
||||
app_id: None,
|
||||
size: Vector2::from([0; 2]),
|
||||
max_size: Vector2::from([0; 2]),
|
||||
min_size: Vector2::from([0; 2]),
|
||||
max_size: None,
|
||||
min_size: None,
|
||||
states: Vec::new(),
|
||||
queued_state: None,
|
||||
}
|
||||
|
||||
@@ -299,12 +299,12 @@ impl Dispatch<XdgToplevel, XdgToplevelData, WaylandState> for WaylandState {
|
||||
xdg_toplevel::Request::SetTitle { title } => {
|
||||
let mut state = data.state.lock();
|
||||
let queued_state = state.queued_state.as_mut().unwrap();
|
||||
queued_state.title = title;
|
||||
queued_state.title = Some(title);
|
||||
}
|
||||
xdg_toplevel::Request::SetAppId { app_id } => {
|
||||
let mut state = data.state.lock();
|
||||
let queued_state = state.queued_state.as_mut().unwrap();
|
||||
queued_state.app_id = app_id;
|
||||
queued_state.app_id = Some(app_id);
|
||||
}
|
||||
xdg_toplevel::Request::ShowWindowMenu {
|
||||
seat: _,
|
||||
@@ -321,12 +321,12 @@ impl Dispatch<XdgToplevel, XdgToplevelData, WaylandState> for WaylandState {
|
||||
xdg_toplevel::Request::SetMaxSize { width, height } => {
|
||||
let mut state = data.state.lock();
|
||||
let queued_state = state.queued_state.as_mut().unwrap();
|
||||
queued_state.max_size = Vector2::from([width as u32, height as u32]);
|
||||
queued_state.max_size = Some(Vector2::from([width as u32, height as u32]));
|
||||
}
|
||||
xdg_toplevel::Request::SetMinSize { width, height } => {
|
||||
let mut state = data.state.lock();
|
||||
let queued_state = state.queued_state.as_mut().unwrap();
|
||||
queued_state.min_size = Vector2::from([width as u32, height as u32]);
|
||||
queued_state.min_size = Some(Vector2::from([width as u32, height as u32]));
|
||||
}
|
||||
xdg_toplevel::Request::SetMaximized => (),
|
||||
xdg_toplevel::Request::UnsetMaximized => (),
|
||||
|
||||
Reference in New Issue
Block a user