Partly revert "Only render mapped surfaces"

This reverts most of commit 520dd5ce02,
because it is now handled by wlroots.
The iterator -> callback renames have been kept in place.
This commit is contained in:
tiosgz 2021-11-24 19:55:20 +00:00
parent b238994996
commit aa9776f006
4 changed files with 17 additions and 95 deletions

View file

@ -71,7 +71,7 @@ struct kiwmi_view {
struct kiwmi_view_impl {
void (*close)(struct kiwmi_view *view);
void (*for_each_mapped_surface)(
void (*for_each_surface)(
struct kiwmi_view *view,
wlr_surface_iterator_func_t callback,
void *user_data);
@ -131,7 +131,7 @@ struct kiwmi_request_resize_event {
};
void view_close(struct kiwmi_view *view);
void view_for_each_mapped_surface(
void view_for_each_surface(
struct kiwmi_view *view,
wlr_surface_iterator_func_t callback,
void *user_data);

View file

@ -179,8 +179,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
struct kiwmi_view *view;
wl_list_for_each (view, &desktop->views, link) {
view_for_each_mapped_surface(
view, send_frame_done_to_surface, &now);
view_for_each_surface(view, send_frame_done_to_surface, &now);
}
if (render_cursors(wlr_output)) {
@ -227,7 +226,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
rdata.data = view;
wl_signal_emit(&view->events.pre_render, &rdata);
view_for_each_mapped_surface(view, render_surface, &rdata);
view_for_each_surface(view, render_surface, &rdata);
wl_signal_emit(&view->events.post_render, &rdata);
}

View file

@ -24,13 +24,13 @@ view_close(struct kiwmi_view *view)
}
void
view_for_each_mapped_surface(
view_for_each_surface(
struct kiwmi_view *view,
wlr_surface_iterator_func_t callback,
void *user_data)
{
if (view->impl->for_each_mapped_surface) {
view->impl->for_each_mapped_surface(view, callback, user_data);
if (view->impl->for_each_surface) {
view->impl->for_each_surface(view, callback, user_data);
}
}

View file

@ -294,89 +294,12 @@ xdg_shell_view_close(struct kiwmi_view *view)
}
static void
surface_for_each_mapped_surface(
struct wlr_surface *surface,
int x,
int y,
wlr_surface_iterator_func_t callback,
void *user_data)
{
struct wlr_subsurface *subsurface;
wl_list_for_each (
subsurface, &surface->current.subsurfaces_below, current.link) {
if (!subsurface->mapped) {
continue;
}
surface_for_each_mapped_surface(
subsurface->surface,
x + subsurface->current.x,
y + subsurface->current.y,
callback,
user_data);
}
callback(surface, x, y, user_data);
wl_list_for_each (
subsurface, &surface->current.subsurfaces_above, current.link) {
if (!subsurface->mapped) {
continue;
}
surface_for_each_mapped_surface(
subsurface->surface,
x + subsurface->current.x,
y + subsurface->current.y,
callback,
user_data);
}
}
static void
xdg_surface_for_each_mapped_popup_surface(
struct wlr_xdg_surface *surface,
int x,
int y,
wlr_surface_iterator_func_t callback,
void *user_data)
{
struct wlr_xdg_popup *popup;
wl_list_for_each (popup, &surface->popups, link) {
struct wlr_xdg_surface *popup_surface = popup->base;
if (!popup_surface->configured || !popup_surface->mapped) {
continue;
}
double popup_sx, popup_sy;
wlr_xdg_popup_get_position(popup, &popup_sx, &popup_sy);
surface_for_each_mapped_surface(
popup_surface->surface,
x + popup_sx,
y + popup_sy,
callback,
user_data);
xdg_surface_for_each_mapped_popup_surface(
popup_surface, x + popup_sx, y + popup_sy, callback, user_data);
}
}
static void
xdg_shell_view_for_each_mapped_surface(
xdg_shell_view_for_each_surface(
struct kiwmi_view *view,
wlr_surface_iterator_func_t callback,
void *user_data)
{
if (!view->mapped) {
return;
}
// Have to copy over the wlroots implementation with only small changes
surface_for_each_mapped_surface(
view->xdg_surface->surface, 0, 0, callback, user_data);
xdg_surface_for_each_mapped_popup_surface(
view->xdg_surface, 0, 0, callback, user_data);
wlr_xdg_surface_for_each_surface(view->xdg_surface, callback, user_data);
}
static pid_t
@ -439,7 +362,7 @@ xdg_shell_view_surface_at(
static const struct kiwmi_view_impl xdg_shell_view_impl = {
.close = xdg_shell_view_close,
.for_each_mapped_surface = xdg_shell_view_for_each_mapped_surface,
.for_each_surface = xdg_shell_view_for_each_surface,
.get_pid = xdg_shell_view_get_pid,
.get_string_prop = xdg_shell_view_get_string_prop,
.set_activated = xdg_shell_view_set_activated,