fix(wayland): remove unwraps
This commit is contained in:
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use crate::nodes::Node;
|
||||
|
||||
use super::{panel_item::PanelItem, state::WaylandState, surface::CoreSurface};
|
||||
use super::{panel_item::PanelItem, state::WaylandState};
|
||||
use smithay::{
|
||||
delegate_xdg_shell,
|
||||
reexports::{
|
||||
@@ -37,29 +37,30 @@ impl XdgShellHandler for WaylandState {
|
||||
surface.send_configure();
|
||||
}
|
||||
fn ack_configure(&mut self, surface: WlSurface, configure: Configure) {
|
||||
match configure {
|
||||
Configure::Toplevel(config) => {
|
||||
if let Some(size) = config.state.size {
|
||||
compositor::with_states(&surface, |data| {
|
||||
if let Some(panel_node) = data.data_map.get::<Arc<Node>>() {
|
||||
if let Some(core_surface) = data.data_map.get::<Arc<CoreSurface>>() {
|
||||
let panel_item = PanelItem::from_node(panel_node);
|
||||
let has_data = core_surface
|
||||
.with_data(|data| {
|
||||
data.size.x = size.w as u32;
|
||||
data.size.y = size.h as u32;
|
||||
})
|
||||
.is_some();
|
||||
if has_data {
|
||||
panel_item.resize();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Configure::Popup(_) => (),
|
||||
}
|
||||
// let size = match configure {
|
||||
// Configure::Toplevel(config) => config.state.size,
|
||||
// Configure::Popup(_) => return,
|
||||
// };
|
||||
// let core_surface = match configure {
|
||||
// Configure::Toplevel(config) => {
|
||||
// .and_then(|panel| panel.core_surface())
|
||||
// }
|
||||
// Configure::Popup(_) => return,
|
||||
// };
|
||||
let Some(panel_item_node) = compositor::with_states(&surface, |data| {
|
||||
data.data_map.get::<Arc<Node>>().cloned()
|
||||
}) else { return };
|
||||
let Some(panel_item) = PanelItem::from_node(&panel_item_node) else { return };
|
||||
panel_item.ack_resize(configure);
|
||||
|
||||
// let has_data = core_surface
|
||||
// .with_data(|data| {
|
||||
// data.size.x = size.w as u32;
|
||||
// data.size.y = size.h as u32;
|
||||
// })
|
||||
// .is_some();
|
||||
// if has_data {
|
||||
// }
|
||||
}
|
||||
|
||||
fn new_popup(&mut self, _surface: PopupSurface, _positioner: PositionerState) {}
|
||||
|
||||
Reference in New Issue
Block a user