mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 21:05:58 +01:00
Fix popup positioning & double popups
This commit is contained in:
parent
52baf3dd8a
commit
941f88ce23
2 changed files with 32 additions and 8 deletions
|
@ -175,8 +175,7 @@ static void create_popup() {
|
||||||
xdg_positioner_set_size(xdg_positioner, 256, 256);
|
xdg_positioner_set_size(xdg_positioner, 256, 256);
|
||||||
xdg_positioner_set_offset(xdg_positioner, 0, 0);
|
xdg_positioner_set_offset(xdg_positioner, 0, 0);
|
||||||
xdg_positioner_set_anchor_rect(xdg_positioner, cur_x, cur_y, 1, 1);
|
xdg_positioner_set_anchor_rect(xdg_positioner, cur_x, cur_y, 1, 1);
|
||||||
xdg_positioner_set_anchor(xdg_positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
|
xdg_positioner_set_anchor(xdg_positioner, XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT);
|
||||||
xdg_positioner_set_gravity(xdg_positioner, XDG_POSITIONER_GRAVITY_TOP_LEFT);
|
|
||||||
|
|
||||||
popup = xdg_surface_get_popup(xdg_surface, NULL, xdg_positioner);
|
popup = xdg_surface_get_popup(xdg_surface, NULL, xdg_positioner);
|
||||||
assert(popup);
|
assert(popup);
|
||||||
|
|
|
@ -465,6 +465,33 @@ static void layer_surface_iterator(struct wlr_surface *surface,
|
||||||
iter_data->user_data);
|
iter_data->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void xdg_surface_for_each_surface(struct wlr_xdg_surface *surface,
|
||||||
|
int x, int y, wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
|
struct layer_surface_iterator_data data = {
|
||||||
|
.user_iterator = iterator,
|
||||||
|
.user_data = user_data,
|
||||||
|
.x = x, .y = y,
|
||||||
|
};
|
||||||
|
wlr_surface_for_each_surface(
|
||||||
|
surface->surface, layer_surface_iterator, &data);
|
||||||
|
|
||||||
|
struct wlr_xdg_popup *popup_state;
|
||||||
|
wl_list_for_each(popup_state, &surface->popups, link) {
|
||||||
|
struct wlr_xdg_surface *popup = popup_state->base;
|
||||||
|
if (!popup->configured) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
double popup_sx, popup_sy;
|
||||||
|
wlr_xdg_surface_popup_get_position(popup, &popup_sx, &popup_sy);
|
||||||
|
|
||||||
|
xdg_surface_for_each_surface(popup,
|
||||||
|
x + popup_sx,
|
||||||
|
y + popup_sy,
|
||||||
|
iterator, user_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void layer_surface_for_each_surface(struct wlr_layer_surface *surface,
|
static void layer_surface_for_each_surface(struct wlr_layer_surface *surface,
|
||||||
int x, int y, wlr_surface_iterator_func_t iterator, void *user_data) {
|
int x, int y, wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
struct layer_surface_iterator_data data = {
|
struct layer_surface_iterator_data data = {
|
||||||
|
@ -483,13 +510,11 @@ static void layer_surface_for_each_surface(struct wlr_layer_surface *surface,
|
||||||
}
|
}
|
||||||
|
|
||||||
double popup_sx, popup_sy;
|
double popup_sx, popup_sy;
|
||||||
popup_sx = popup->geometry.x;
|
popup_sx = popup->popup->geometry.x - popup->geometry.x;
|
||||||
popup_sy = popup->geometry.y;
|
popup_sy = popup->popup->geometry.y - popup->geometry.y;
|
||||||
|
|
||||||
iterator(popup->surface, data.x + popup_sx,
|
xdg_surface_for_each_surface(popup,
|
||||||
data.y + popup_sy, user_data);
|
popup_sx, popup_sy, iterator, user_data);
|
||||||
|
|
||||||
wlr_xdg_surface_for_each_surface(popup, layer_surface_iterator, &data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue