fix(wayland): xdg surface size when not set
This commit is contained in:
@@ -512,7 +512,14 @@ impl PanelItem {
|
|||||||
{
|
{
|
||||||
let queued_state = state.queued_state.as_mut().unwrap();
|
let queued_state = state.queued_state.as_mut().unwrap();
|
||||||
queued_state.mapped = mapped;
|
queued_state.mapped = mapped;
|
||||||
queued_state.size = *surface_data.size.lock();
|
if mapped {
|
||||||
|
queued_state.size = surface_data.size.lock().unwrap_or_else(|| {
|
||||||
|
self.core_surface()
|
||||||
|
.unwrap()
|
||||||
|
.with_data(|data| Vector2::from([data.size.x / 2, data.size.y / 2]))
|
||||||
|
.unwrap()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(node) = self.node.upgrade() else { return };
|
let Some(node) = self.node.upgrade() else { return };
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ impl GlobalDispatch<XdgWmBase, (), WaylandState> for WaylandState {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct WaylandSurface {
|
pub struct WaylandSurface {
|
||||||
wl_surface: Weak<WlSurface>,
|
wl_surface: Weak<WlSurface>,
|
||||||
size: Arc<Mutex<Vector2<u32>>>,
|
size: Arc<Mutex<Option<Vector2<u32>>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Dispatch<XdgWmBase, (), WaylandState> for WaylandState {
|
impl Dispatch<XdgWmBase, (), WaylandState> for WaylandState {
|
||||||
@@ -105,7 +105,7 @@ impl Dispatch<XdgWmBase, (), WaylandState> for WaylandState {
|
|||||||
id,
|
id,
|
||||||
WaylandSurface {
|
WaylandSurface {
|
||||||
wl_surface: surface.downgrade(),
|
wl_surface: surface.downgrade(),
|
||||||
size: Arc::new(Mutex::new(Vector2::from([0; 2]))),
|
size: Arc::new(Mutex::new(None)),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ impl Dispatch<XdgPositioner, Arc<Mutex<PositionerData>>, WaylandState> for Wayla
|
|||||||
pub struct XdgSurfaceData {
|
pub struct XdgSurfaceData {
|
||||||
pub wl_surface: Weak<WlSurface>,
|
pub wl_surface: Weak<WlSurface>,
|
||||||
pub xdg_surface: Weak<XdgSurface>,
|
pub xdg_surface: Weak<XdgSurface>,
|
||||||
pub size: Arc<Mutex<Vector2<u32>>>,
|
pub size: Arc<Mutex<Option<Vector2<u32>>>>,
|
||||||
}
|
}
|
||||||
impl Dispatch<XdgSurface, WaylandSurface, WaylandState> for WaylandState {
|
impl Dispatch<XdgSurface, WaylandSurface, WaylandState> for WaylandState {
|
||||||
fn request(
|
fn request(
|
||||||
@@ -266,7 +266,7 @@ impl Dispatch<XdgSurface, WaylandSurface, WaylandState> for WaylandState {
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
} => {
|
} => {
|
||||||
*data.size.lock() = Vector2::from([width as u32, height as u32]);
|
*data.size.lock() = Some(Vector2::from([width as u32, height as u32]));
|
||||||
}
|
}
|
||||||
xdg_surface::Request::AckConfigure { serial: _ } => (),
|
xdg_surface::Request::AckConfigure { serial: _ } => (),
|
||||||
xdg_surface::Request::Destroy => (),
|
xdg_surface::Request::Destroy => (),
|
||||||
|
|||||||
Reference in New Issue
Block a user