diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 31ec2ce5..d241f69a 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -207,7 +207,7 @@ swayc_t *destroy_output(swayc_t *output) { | |||
207 | } | 207 | } |
208 | 208 | ||
209 | swayc_t *destroy_view(swayc_t *view) { | 209 | swayc_t *destroy_view(swayc_t *view) { |
210 | if (!sway_assert(view, "null view passed to destroy_view")) { | 210 | if (!view) { |
211 | return NULL; | 211 | return NULL; |
212 | } | 212 | } |
213 | wlr_log(L_DEBUG, "Destroying view '%s'", view->name); | 213 | wlr_log(L_DEBUG, "Destroying view '%s'", view->name); |
@@ -259,7 +259,6 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | |||
259 | int width = swayc->sway_view->surface->current->width; | 259 | int width = swayc->sway_view->surface->current->width; |
260 | int height = swayc->sway_view->surface->current->height; | 260 | int height = swayc->sway_view->surface->current->height; |
261 | 261 | ||
262 | // TODO popups and subsurfaces | ||
263 | switch (sview->type) { | 262 | switch (sview->type) { |
264 | case SWAY_WL_SHELL_VIEW: | 263 | case SWAY_WL_SHELL_VIEW: |
265 | break; | 264 | break; |
@@ -268,6 +267,20 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | |||
268 | // coordinate of the top left corner of the window geometry | 267 | // coordinate of the top left corner of the window geometry |
269 | view_sx += sview->wlr_xdg_surface_v6->geometry->x; | 268 | view_sx += sview->wlr_xdg_surface_v6->geometry->x; |
270 | view_sy += sview->wlr_xdg_surface_v6->geometry->y; | 269 | view_sy += sview->wlr_xdg_surface_v6->geometry->y; |
270 | |||
271 | // check for popups | ||
272 | double popup_sx, popup_sy; | ||
273 | struct wlr_xdg_surface_v6 *popup = | ||
274 | wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, | ||
275 | view_sx, view_sy, &popup_sx, &popup_sy); | ||
276 | |||
277 | if (popup) { | ||
278 | *sx = view_sx - popup_sx; | ||
279 | *sy = view_sy - popup_sy; | ||
280 | *surface = popup->surface; | ||
281 | list_free(queue); | ||
282 | return swayc; | ||
283 | } | ||
271 | break; | 284 | break; |
272 | case SWAY_XWAYLAND_VIEW: | 285 | case SWAY_XWAYLAND_VIEW: |
273 | break; | 286 | break; |
@@ -275,6 +288,19 @@ swayc_t *swayc_at(swayc_t *parent, double lx, double ly, | |||
275 | break; | 288 | break; |
276 | } | 289 | } |
277 | 290 | ||
291 | // check for subsurfaces | ||
292 | double sub_x, sub_y; | ||
293 | struct wlr_subsurface *subsurface = | ||
294 | wlr_surface_subsurface_at(sview->surface, | ||
295 | view_sx, view_sy, &sub_x, &sub_y); | ||
296 | if (subsurface) { | ||
297 | *sx = view_sx - sub_x; | ||
298 | *sy = view_sy - sub_y; | ||
299 | *surface = subsurface->surface; | ||
300 | list_free(queue); | ||
301 | return swayc; | ||
302 | } | ||
303 | |||
278 | if (view_sx > 0 && view_sx < width && | 304 | if (view_sx > 0 && view_sx < width && |
279 | view_sy > 0 && view_sy < height && | 305 | view_sy > 0 && view_sy < height && |
280 | pixman_region32_contains_point( | 306 | pixman_region32_contains_point( |