fix popup geometry calculation and relative
placement to parent geometry
This commit is contained in:
parent
7114111ba5
commit
6b2273235a
|
@ -211,9 +211,16 @@ where
|
|||
result = Err(err);
|
||||
}
|
||||
// furthermore, draw its popups
|
||||
let toplevel_geometry_offset = window_map
|
||||
.geometry(toplevel_surface)
|
||||
.map(|g| (g.x, g.y))
|
||||
.unwrap_or_default();
|
||||
window_map.with_child_popups(&wl_surface, |popup| {
|
||||
let location = popup.location();
|
||||
let draw_location = (initial_place.0 + location.0, initial_place.1 + location.1);
|
||||
let draw_location = (
|
||||
initial_place.0 + location.0 + toplevel_geometry_offset.0,
|
||||
initial_place.1 + location.1 + toplevel_geometry_offset.1,
|
||||
);
|
||||
if let Some(wl_surface) = popup.get_surface() {
|
||||
if let Err(err) = draw_surface_tree(renderer, frame, &wl_surface, draw_location, log) {
|
||||
result = Err(err);
|
||||
|
|
|
@ -490,13 +490,13 @@ impl PositionerState {
|
|||
// gravity specified.
|
||||
if self.gravity_has_edge(xdg_positioner::Gravity::Top) {
|
||||
geometry.y -= geometry.height;
|
||||
} else if self.gravity_has_edge(xdg_positioner::Gravity::Bottom) {
|
||||
} else if !self.gravity_has_edge(xdg_positioner::Gravity::Bottom) {
|
||||
geometry.y -= geometry.height / 2;
|
||||
}
|
||||
|
||||
if self.gravity_has_edge(xdg_positioner::Gravity::Left) {
|
||||
geometry.x -= geometry.width;
|
||||
} else if self.gravity_has_edge(xdg_positioner::Gravity::Right) {
|
||||
} else if !self.gravity_has_edge(xdg_positioner::Gravity::Right) {
|
||||
geometry.x -= geometry.width / 2;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue