diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-04 22:12:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 22:12:32 -0400 |
commit | 21aedf15052df4e7f8ee72922fa0e214d690facc (patch) | |
tree | 42039b2d318ab944dd148990329b4a2cf94fd9a3 /sway/tree/container.c | |
parent | Merge pull request #1707 from acrisci/transparency (diff) | |
parent | Use new wlr_*_surface_at functions (diff) | |
download | sway-21aedf15052df4e7f8ee72922fa0e214d690facc.tar.gz sway-21aedf15052df4e7f8ee72922fa0e214d690facc.tar.zst sway-21aedf15052df4e7f8ee72922fa0e214d690facc.zip |
Merge pull request #1732 from emersion/view-children
Update for wlroots#824
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 68 |
1 files changed, 25 insertions, 43 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 3be08645..bd9f1edf 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -412,51 +412,33 @@ struct sway_container *container_at(struct sway_container *parent, | |||
412 | double view_sx = ox - swayc->x; | 412 | double view_sx = ox - swayc->x; |
413 | double view_sy = oy - swayc->y; | 413 | double view_sy = oy - swayc->y; |
414 | 414 | ||
415 | double _sx, _sy; | ||
416 | struct wlr_surface *_surface; | ||
415 | switch (sview->type) { | 417 | switch (sview->type) { |
416 | case SWAY_WL_SHELL_VIEW: | 418 | case SWAY_VIEW_XWAYLAND: |
417 | break; | 419 | _surface = wlr_surface_surface_at(sview->surface, |
418 | case SWAY_XDG_SHELL_V6_VIEW: | 420 | view_sx, view_sy, &_sx, &_sy); |
419 | // the top left corner of the sway container is the | 421 | break; |
420 | // coordinate of the top left corner of the window geometry | 422 | case SWAY_VIEW_WL_SHELL: |
421 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; | 423 | _surface = wlr_wl_shell_surface_surface_at( |
422 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; | 424 | sview->wlr_wl_shell_surface, |
423 | 425 | view_sx, view_sy, &_sx, &_sy); | |
424 | // check for popups | 426 | break; |
425 | double popup_sx, popup_sy; | 427 | case SWAY_VIEW_XDG_SHELL_V6: |
426 | struct wlr_xdg_surface_v6 *popup = | 428 | // the top left corner of the sway container is the |
427 | wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, | 429 | // coordinate of the top left corner of the window geometry |
428 | view_sx, view_sy, &popup_sx, &popup_sy); | 430 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; |
429 | 431 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; | |
430 | if (popup) { | 432 | |
431 | *sx = view_sx - popup_sx; | 433 | _surface = wlr_xdg_surface_v6_surface_at( |
432 | *sy = view_sy - popup_sy; | 434 | sview->wlr_xdg_surface_v6, |
433 | *surface = popup->surface; | 435 | view_sx, view_sy, &_sx, &_sy); |
434 | return swayc; | 436 | break; |
435 | } | ||
436 | break; | ||
437 | case SWAY_XWAYLAND_VIEW: | ||
438 | break; | ||
439 | default: | ||
440 | break; | ||
441 | } | ||
442 | |||
443 | // check for subsurfaces | ||
444 | double sub_x, sub_y; | ||
445 | struct wlr_subsurface *subsurface = | ||
446 | wlr_surface_subsurface_at(sview->surface, | ||
447 | view_sx, view_sy, &sub_x, &sub_y); | ||
448 | if (subsurface) { | ||
449 | *sx = view_sx - sub_x; | ||
450 | *sy = view_sy - sub_y; | ||
451 | *surface = subsurface->surface; | ||
452 | return swayc; | ||
453 | } | 437 | } |
454 | 438 | if (_surface) { | |
455 | if (wlr_surface_point_accepts_input( | 439 | *sx = _sx; |
456 | sview->surface, view_sx, view_sy)) { | 440 | *sy = _sy; |
457 | *sx = view_sx; | 441 | *surface = _surface; |
458 | *sy = view_sy; | ||
459 | *surface = swayc->sway_view->surface; | ||
460 | return swayc; | 442 | return swayc; |
461 | } | 443 | } |
462 | } else { | 444 | } else { |