xdg-popup: render popups in the right place

This commit is contained in:
Tony Crisci 2017-10-02 09:15:21 -04:00
parent 86b66f1d6f
commit e003296c23
4 changed files with 39 additions and 2 deletions

View file

@ -53,10 +53,33 @@ static void render_surface(struct wlr_surface *surface,
}
}
static void render_xdg_v6_popups(struct wlr_xdg_surface_v6 *surface,
struct roots_desktop *desktop, struct wlr_output *wlr_output,
struct timespec *when, double base_x, double base_y) {
struct wlr_xdg_surface_v6 *popup;
wl_list_for_each(popup, &surface->popups, popup_link) {
if (!popup->configured) {
continue;
}
double popup_x = base_x + surface->geometry->x +
popup->popup_state->geometry.x - popup->geometry->x;
double popup_y = base_y + surface->geometry->y +
popup->popup_state->geometry.y - popup->geometry->y;
render_surface(popup->surface, desktop, wlr_output, when, popup_x,
popup_y);
render_xdg_v6_popups(popup, desktop, wlr_output, when, popup_x, popup_y);
}
}
static void render_view(struct roots_view *view, struct roots_desktop *desktop,
struct wlr_output *wlr_output, struct timespec *when) {
render_surface(view->wlr_surface, desktop, wlr_output, when,
view->x, view->y);
if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
render_xdg_v6_popups(view->xdg_surface_v6, desktop, wlr_output,
when, view->x, view->y);
}
}
static void output_frame_notify(struct wl_listener *listener, void *data) {