Add example for setting the initial popup geometry
This commit is contained in:
parent
6d3d5f7933
commit
85fa46ad2c
|
@ -374,10 +374,21 @@ pub fn init_shell<BackendData: 'static>(display: Rc<RefCell<Display>>, log: ::sl
|
||||||
.borrow_mut()
|
.borrow_mut()
|
||||||
.insert(SurfaceKind::Xdg(surface), (x, y).into());
|
.insert(SurfaceKind::Xdg(surface), (x, y).into());
|
||||||
}
|
}
|
||||||
XdgRequest::NewPopup { surface, .. } => {
|
XdgRequest::NewPopup { surface, positioner } => {
|
||||||
// Do not send a configure here, the initial configure
|
// Do not send a configure here, the initial configure
|
||||||
// of a xdg_surface has to be sent during the commit if
|
// of a xdg_surface has to be sent during the commit if
|
||||||
// the surface is not already configured
|
// 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));
|
xdg_window_map.borrow_mut().insert_popup(PopupKind::Xdg(surface));
|
||||||
}
|
}
|
||||||
XdgRequest::RePosition {
|
XdgRequest::RePosition {
|
||||||
|
@ -1108,7 +1119,6 @@ fn surface_commit(
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
if !initial_configure_sent {
|
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
|
// NOTE: This should never fail as the initial configure is always
|
||||||
// allowed.
|
// allowed.
|
||||||
popup.send_configure().expect("initial configure failed");
|
popup.send_configure().expect("initial configure failed");
|
||||||
|
|
Loading…
Reference in New Issue