mirror of
https://github.com/swaywm/sway.git
synced 2026-04-22 06:46:27 -04:00
view: fix child position calc
Previously, the position was calculated incorrectly for nested subsurfaces.
This commit is contained in:
parent
adf9e16c88
commit
e76e13ef85
3 changed files with 22 additions and 34 deletions
|
|
@ -21,18 +21,15 @@
|
|||
|
||||
static const struct sway_view_child_impl popup_impl;
|
||||
|
||||
static void popup_get_root_coords(struct sway_view_child *child,
|
||||
int *root_sx, int *root_sy) {
|
||||
static void popup_get_view_coords(struct sway_view_child *child,
|
||||
int *sx, int *sy) {
|
||||
struct sway_xdg_popup *popup = (struct sway_xdg_popup *)child;
|
||||
struct wlr_xdg_surface *surface = popup->wlr_xdg_surface;
|
||||
|
||||
int x_offset = -child->view->geometry.x - surface->geometry.x;
|
||||
int y_offset = -child->view->geometry.y - surface->geometry.y;
|
||||
|
||||
wlr_xdg_popup_get_toplevel_coords(surface->popup,
|
||||
x_offset + surface->popup->geometry.x,
|
||||
y_offset + surface->popup->geometry.y,
|
||||
root_sx, root_sy);
|
||||
surface->popup->geometry.x - surface->geometry.x,
|
||||
surface->popup->geometry.y - surface->geometry.y,
|
||||
sx, sy);
|
||||
}
|
||||
|
||||
static void popup_destroy(struct sway_view_child *child) {
|
||||
|
|
@ -47,7 +44,7 @@ static void popup_destroy(struct sway_view_child *child) {
|
|||
}
|
||||
|
||||
static const struct sway_view_child_impl popup_impl = {
|
||||
.get_root_coords = popup_get_root_coords,
|
||||
.get_view_coords = popup_get_view_coords,
|
||||
.destroy = popup_destroy,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue