diff --git a/anvil/src/shell.rs b/anvil/src/shell.rs index c8976f4..5d6bdd7 100644 --- a/anvil/src/shell.rs +++ b/anvil/src/shell.rs @@ -374,10 +374,21 @@ pub fn init_shell(display: Rc>, log: ::sl .borrow_mut() .insert(SurfaceKind::Xdg(surface), (x, y).into()); } - XdgRequest::NewPopup { surface, .. } => { + XdgRequest::NewPopup { surface, positioner } => { // Do not send a configure here, the initial configure // of a xdg_surface has to be sent during the commit if // the surface is not already configured + + // TODO: properly recompute the geometry with the whole of positioner state + surface + .with_pending_state(|state| { + // NOTE: This is not really necessary as the default geometry + // is already set the same way, but for demonstrating how + // to set the initial popup geometry this code is left as + // an example + state.geometry = positioner.get_geometry(); + }) + .unwrap(); xdg_window_map.borrow_mut().insert_popup(PopupKind::Xdg(surface)); } XdgRequest::RePosition { @@ -1108,7 +1119,6 @@ fn surface_commit( }) .unwrap(); if !initial_configure_sent { - // TODO: properly recompute the geometry with the whole of positioner state // NOTE: This should never fail as the initial configure is always // allowed. popup.send_configure().expect("initial configure failed");