mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 18:39:48 +01:00
Basic layer popup rendering
This commit is contained in:
parent
d3cdb00208
commit
278aa84619
3 changed files with 52 additions and 0 deletions
|
@ -109,4 +109,8 @@ bool wlr_surface_is_layer_surface(struct wlr_surface *surface);
|
||||||
struct wlr_layer_surface *wlr_layer_surface_from_wlr_surface(
|
struct wlr_layer_surface *wlr_layer_surface_from_wlr_surface(
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
|
/* Calls the iterator function for each sub-surface and popup of this surface */
|
||||||
|
void wlr_layer_surface_for_each_surface(struct wlr_layer_surface *surface,
|
||||||
|
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -366,6 +366,8 @@ static void render_layer(struct roots_output *output,
|
||||||
roots_surface->geo.x + output_layout_box->x,
|
roots_surface->geo.x + output_layout_box->x,
|
||||||
roots_surface->geo.y + output_layout_box->y,
|
roots_surface->geo.y + output_layout_box->y,
|
||||||
0, &data->layout, render_surface, data);
|
0, &data->layout, render_surface, data);
|
||||||
|
|
||||||
|
wlr_layer_surface_for_each_surface(layer, render_surface, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -452,3 +452,49 @@ void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell) {
|
||||||
wl_global_destroy(layer_shell->wl_global);
|
wl_global_destroy(layer_shell->wl_global);
|
||||||
free(layer_shell);
|
free(layer_shell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct layer_surface_iterator_data {
|
||||||
|
wlr_surface_iterator_func_t user_iterator;
|
||||||
|
void *user_data;
|
||||||
|
int x, y;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void layer_surface_iterator(struct wlr_surface *surface,
|
||||||
|
int sx, int sy, void *data) {
|
||||||
|
struct layer_surface_iterator_data *iter_data = data;
|
||||||
|
iter_data->user_iterator(surface, iter_data->x + sx, iter_data->y + sy,
|
||||||
|
iter_data->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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;
|
||||||
|
popup_sx = popup->geometry.x;
|
||||||
|
popup_sy = popup->geometry.y;
|
||||||
|
|
||||||
|
iterator(popup->surface, data.x + popup_sx,
|
||||||
|
data.y + popup_sy, user_data);
|
||||||
|
|
||||||
|
wlr_xdg_surface_for_each_surface(popup, layer_surface_iterator, &data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wlr_layer_surface_for_each_surface(struct wlr_layer_surface *surface,
|
||||||
|
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||||
|
layer_surface_for_each_surface(surface, 0, 0, iterator, user_data);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue