diff options
-rw-r--r-- | types/wlr_layer_shell_v1.c | 44 | ||||
-rw-r--r-- | types/xdg_shell/wlr_xdg_surface.c | 30 |
2 files changed, 10 insertions, 64 deletions
diff --git a/types/wlr_layer_shell_v1.c b/types/wlr_layer_shell_v1.c index 443ac9c7..16efd81d 100644 --- a/types/wlr_layer_shell_v1.c +++ b/types/wlr_layer_shell_v1.c @@ -530,42 +530,9 @@ static void layer_surface_iterator(struct wlr_surface *surface, 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_state->geometry.x - popup_state->base->geometry.x; - double popup_sy = popup_state->geometry.y - popup_state->base->geometry.y; - - xdg_surface_for_each_surface(popup, - x + popup_sx, - y + popup_sy, - iterator, user_data); - } -} - void wlr_layer_surface_v1_for_each_surface(struct wlr_layer_surface_v1 *surface, wlr_surface_iterator_func_t iterator, void *user_data) { - struct layer_surface_iterator_data data = { - .user_iterator = iterator, - .user_data = user_data, - .x = 0, .y = 0, - }; - wlr_surface_for_each_surface(surface->surface, - layer_surface_iterator, &data); + wlr_surface_for_each_surface(surface->surface, iterator, user_data); wlr_layer_surface_v1_for_each_popup(surface, iterator, user_data); } @@ -582,8 +549,13 @@ void wlr_layer_surface_v1_for_each_popup(struct wlr_layer_surface_v1 *surface, popup_sx = popup->popup->geometry.x - popup->geometry.x; popup_sy = popup->popup->geometry.y - popup->geometry.y; - xdg_surface_for_each_surface(popup, - popup_sx, popup_sy, iterator, user_data); + struct layer_surface_iterator_data data = { + .user_iterator = iterator, + .user_data = user_data, + .x = popup_sx, .y = popup_sy, + }; + + wlr_xdg_surface_for_each_surface(popup, layer_surface_iterator, &data); } } diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index d4e0c6f0..fa9d99eb 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -626,33 +626,6 @@ static void xdg_surface_iterator(struct wlr_surface *surface, 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 xdg_surface_iterator_data data = { - .user_iterator = iterator, - .user_data = user_data, - .x = x, .y = y, - }; - wlr_surface_for_each_surface(surface->surface, xdg_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; - xdg_popup_get_position(popup_state, &popup_sx, &popup_sy); - - xdg_surface_for_each_surface(popup, - x + popup_sx, - y + popup_sy, - iterator, user_data); - } -} - static void xdg_surface_for_each_popup(struct wlr_xdg_surface *surface, int x, int y, wlr_surface_iterator_func_t iterator, void *user_data) { struct wlr_xdg_popup *popup_state; @@ -702,7 +675,8 @@ static void xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface, void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface, wlr_surface_iterator_func_t iterator, void *user_data) { - xdg_surface_for_each_surface(surface, 0, 0, iterator, user_data); + wlr_surface_for_each_surface(surface->surface, iterator, user_data); + xdg_surface_for_each_popup_surface(surface, 0, 0, iterator, user_data); } void wlr_xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface, |