diff options
author | emersion <contact@emersion.fr> | 2018-04-04 17:57:12 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2018-04-04 22:03:14 -0400 |
commit | 44b8d30f5254628f8e6d5a12010f6e5f810d756e (patch) | |
tree | 42039b2d318ab944dd148990329b4a2cf94fd9a3 | |
parent | Remove unused SWAY_VIEW_TYPES (diff) | |
download | sway-44b8d30f5254628f8e6d5a12010f6e5f810d756e.tar.gz sway-44b8d30f5254628f8e6d5a12010f6e5f810d756e.tar.zst sway-44b8d30f5254628f8e6d5a12010f6e5f810d756e.zip |
Use new wlr_*_surface_at functions
-rw-r--r-- | sway/desktop/output.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 45 |
2 files changed, 15 insertions, 32 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 38b52a41..0e8a9485 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -204,8 +204,6 @@ static void render_view(struct sway_container *view, void *data) { | |||
204 | case SWAY_VIEW_XWAYLAND: | 204 | case SWAY_VIEW_XWAYLAND: |
205 | render_surface(surface, wlr_output, when, view->x, view->y, 0, alpha); | 205 | render_surface(surface, wlr_output, when, view->x, view->y, 0, alpha); |
206 | break; | 206 | break; |
207 | default: | ||
208 | break; | ||
209 | } | 207 | } |
210 | } | 208 | } |
211 | 209 | ||
diff --git a/sway/tree/container.c b/sway/tree/container.c index 1ea10759..bd9f1edf 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -412,9 +412,17 @@ 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_VIEW_XWAYLAND: | 418 | case SWAY_VIEW_XWAYLAND: |
419 | _surface = wlr_surface_surface_at(sview->surface, | ||
420 | view_sx, view_sy, &_sx, &_sy); | ||
421 | break; | ||
417 | case SWAY_VIEW_WL_SHELL: | 422 | case SWAY_VIEW_WL_SHELL: |
423 | _surface = wlr_wl_shell_surface_surface_at( | ||
424 | sview->wlr_wl_shell_surface, | ||
425 | view_sx, view_sy, &_sx, &_sy); | ||
418 | break; | 426 | break; |
419 | case SWAY_VIEW_XDG_SHELL_V6: | 427 | case SWAY_VIEW_XDG_SHELL_V6: |
420 | // the top left corner of the sway container is the | 428 | // the top left corner of the sway container is the |
@@ -422,38 +430,15 @@ struct sway_container *container_at(struct sway_container *parent, | |||
422 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; | 430 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; |
423 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; | 431 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; |
424 | 432 | ||
425 | // check for popups | 433 | _surface = wlr_xdg_surface_v6_surface_at( |
426 | double popup_sx, popup_sy; | 434 | sview->wlr_xdg_surface_v6, |
427 | struct wlr_xdg_surface_v6 *popup = | 435 | view_sx, view_sy, &_sx, &_sy); |
428 | wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, | ||
429 | view_sx, view_sy, &popup_sx, &popup_sy); | ||
430 | |||
431 | if (popup) { | ||
432 | *sx = view_sx - popup_sx; | ||
433 | *sy = view_sy - popup_sy; | ||
434 | *surface = popup->surface; | ||
435 | return swayc; | ||
436 | } | ||
437 | break; | 436 | break; |
438 | } | 437 | } |
439 | 438 | if (_surface) { | |
440 | // check for subsurfaces | 439 | *sx = _sx; |
441 | double sub_x, sub_y; | 440 | *sy = _sy; |
442 | struct wlr_subsurface *subsurface = | 441 | *surface = _surface; |
443 | wlr_surface_subsurface_at(sview->surface, | ||
444 | view_sx, view_sy, &sub_x, &sub_y); | ||
445 | if (subsurface) { | ||
446 | *sx = view_sx - sub_x; | ||
447 | *sy = view_sy - sub_y; | ||
448 | *surface = subsurface->surface; | ||
449 | return swayc; | ||
450 | } | ||
451 | |||
452 | if (wlr_surface_point_accepts_input( | ||
453 | sview->surface, view_sx, view_sy)) { | ||
454 | *sx = view_sx; | ||
455 | *sy = view_sy; | ||
456 | *surface = swayc->sway_view->surface; | ||
457 | return swayc; | 442 | return swayc; |
458 | } | 443 | } |
459 | } else { | 444 | } else { |