diff --git a/anvil/src/drawing.rs b/anvil/src/drawing.rs index 6b0c693..c39dc6a 100644 --- a/anvil/src/drawing.rs +++ b/anvil/src/drawing.rs @@ -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); diff --git a/src/wayland/shell/xdg/mod.rs b/src/wayland/shell/xdg/mod.rs index 79b99a2..2b82057 100644 --- a/src/wayland/shell/xdg/mod.rs +++ b/src/wayland/shell/xdg/mod.rs @@ -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; }