mirror of
https://github.com/swaywm/sway
synced 2024-11-23 13:22:17 +01:00
Switch to wlr_xdg_surface_for_each_popup_surface
Instead of calling wlr_xdg_surface_for_each_popup and then wlr_surface_for_each_surface, use the new for_each_popup_surface helper introduced in [1] that does it in one go. [1]: https://github.com/swaywm/wlroots/pull/2609
This commit is contained in:
parent
a7414885d2
commit
5438cc158a
@ -116,7 +116,7 @@ void output_view_for_each_surface(struct sway_output *output,
|
||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
||||
void *user_data);
|
||||
|
||||
void output_view_for_each_popup(struct sway_output *output,
|
||||
void output_view_for_each_popup_surface(struct sway_output *output,
|
||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
||||
void *user_data);
|
||||
|
||||
|
@ -47,7 +47,7 @@ struct sway_view_impl {
|
||||
bool (*wants_floating)(struct sway_view *view);
|
||||
void (*for_each_surface)(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
void (*for_each_popup)(struct sway_view *view,
|
||||
void (*for_each_popup_surface)(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
bool (*is_transient_for)(struct sway_view *child,
|
||||
struct sway_view *ancestor);
|
||||
@ -297,9 +297,9 @@ void view_for_each_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
|
||||
/**
|
||||
* Iterate all popups recursively.
|
||||
* Iterate all popup surfaces of a view.
|
||||
*/
|
||||
void view_for_each_popup(struct sway_view *view,
|
||||
void view_for_each_popup_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
|
||||
// view implementation
|
||||
|
@ -179,7 +179,7 @@ void output_view_for_each_surface(struct sway_output *output,
|
||||
view_for_each_surface(view, output_for_each_surface_iterator, &data);
|
||||
}
|
||||
|
||||
void output_view_for_each_popup(struct sway_output *output,
|
||||
void output_view_for_each_popup_surface(struct sway_output *output,
|
||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
||||
void *user_data) {
|
||||
struct surface_iterator_data data = {
|
||||
@ -196,7 +196,7 @@ void output_view_for_each_popup(struct sway_output *output,
|
||||
.rotation = 0, // TODO
|
||||
};
|
||||
|
||||
view_for_each_popup(view, output_for_each_surface_iterator, &data);
|
||||
view_for_each_popup_surface(view, output_for_each_surface_iterator, &data);
|
||||
}
|
||||
|
||||
void output_layer_for_each_surface(struct sway_output *output,
|
||||
|
@ -265,24 +265,14 @@ static void render_view_toplevels(struct sway_view *view,
|
||||
render_surface_iterator, &data);
|
||||
}
|
||||
|
||||
static void render_popup_iterator(struct sway_output *output, struct sway_view *view,
|
||||
struct wlr_surface *surface, struct wlr_box *box, float rotation,
|
||||
void *data) {
|
||||
// Render this popup's surface
|
||||
render_surface_iterator(output, view, surface, box, rotation, data);
|
||||
|
||||
// Render this popup's child toplevels
|
||||
output_surface_for_each_surface(output, surface, box->x, box->y,
|
||||
render_surface_iterator, data);
|
||||
}
|
||||
|
||||
static void render_view_popups(struct sway_view *view,
|
||||
struct sway_output *output, pixman_region32_t *damage, float alpha) {
|
||||
struct render_data data = {
|
||||
.damage = damage,
|
||||
.alpha = alpha,
|
||||
};
|
||||
output_view_for_each_popup(output, view, render_popup_iterator, &data);
|
||||
output_view_for_each_popup_surface(output, view,
|
||||
render_surface_iterator, &data);
|
||||
}
|
||||
|
||||
static void render_saved_view(struct sway_view *view,
|
||||
|
@ -211,12 +211,13 @@ static void for_each_surface(struct sway_view *view,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static void for_each_popup(struct sway_view *view,
|
||||
static void for_each_popup_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||
if (xdg_shell_view_from_view(view) == NULL) {
|
||||
return;
|
||||
}
|
||||
wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, iterator, user_data);
|
||||
wlr_xdg_surface_for_each_popup_surface(view->wlr_xdg_surface, iterator,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static bool is_transient_for(struct sway_view *child,
|
||||
@ -271,7 +272,7 @@ static const struct sway_view_impl view_impl = {
|
||||
.set_resizing = set_resizing,
|
||||
.wants_floating = wants_floating,
|
||||
.for_each_surface = for_each_surface,
|
||||
.for_each_popup = for_each_popup,
|
||||
.for_each_popup_surface = for_each_popup_surface,
|
||||
.is_transient_for = is_transient_for,
|
||||
.close = _close,
|
||||
.close_popups = close_popups,
|
||||
|
@ -449,13 +449,13 @@ void view_for_each_surface(struct sway_view *view,
|
||||
}
|
||||
}
|
||||
|
||||
void view_for_each_popup(struct sway_view *view,
|
||||
void view_for_each_popup_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data) {
|
||||
if (!view->surface) {
|
||||
return;
|
||||
}
|
||||
if (view->impl->for_each_popup) {
|
||||
view->impl->for_each_popup(view, iterator, user_data);
|
||||
if (view->impl->for_each_popup_surface) {
|
||||
view->impl->for_each_popup_surface(view, iterator, user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user