mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-02 11:55:59 +01:00
Don't use unsafe casts in wlr_xdg_popup_get_toplevel_coords
This commit is contained in:
parent
059e5f6690
commit
b28f06eca0
2 changed files with 3 additions and 8 deletions
|
@ -1656,20 +1656,17 @@ void wlr_xdg_popup_get_anchor_point(struct wlr_xdg_popup *popup,
|
||||||
|
|
||||||
void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
|
void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
|
||||||
int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy) {
|
int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy) {
|
||||||
assert(strcmp(popup->parent->role, wlr_desktop_xdg_toplevel_role) == 0
|
struct wlr_xdg_surface *parent =
|
||||||
|| strcmp(popup->parent->role, wlr_desktop_xdg_popup_role) == 0);
|
wlr_xdg_surface_from_wlr_surface(popup->parent);
|
||||||
struct wlr_xdg_surface *parent = popup->parent->role_data;
|
|
||||||
while (parent != NULL && parent->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
while (parent != NULL && parent->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
||||||
popup_sx += parent->popup->geometry.x;
|
popup_sx += parent->popup->geometry.x;
|
||||||
popup_sy += parent->popup->geometry.y;
|
popup_sy += parent->popup->geometry.y;
|
||||||
parent = parent->popup->parent->role_data;
|
parent = wlr_xdg_surface_from_wlr_surface(parent->popup->parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(parent);
|
assert(parent);
|
||||||
|
|
||||||
*toplevel_sx = popup_sx + parent->geometry.x;
|
*toplevel_sx = popup_sx + parent->geometry.x;
|
||||||
*toplevel_sy = popup_sy + parent->geometry.y;
|
*toplevel_sy = popup_sy + parent->geometry.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
|
static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
|
||||||
|
|
|
@ -1673,12 +1673,10 @@ void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
|
||||||
popup_sy += parent->popup->geometry.y;
|
popup_sy += parent->popup->geometry.y;
|
||||||
parent = parent->popup->parent;
|
parent = parent->popup->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(parent);
|
assert(parent);
|
||||||
|
|
||||||
*toplevel_sx = popup_sx + parent->geometry.x;
|
*toplevel_sx = popup_sx + parent->geometry.x;
|
||||||
*toplevel_sy = popup_sy + parent->geometry.y;
|
*toplevel_sy = popup_sy + parent->geometry.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
|
static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
|
||||||
|
|
Loading…
Reference in a new issue