diff options
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 70 |
1 files changed, 27 insertions, 43 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 92c00f83..8fc9e3e8 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -78,6 +78,8 @@ struct sway_container *container_create(enum sway_container_type type) { | |||
78 | c->layout = L_NONE; | 78 | c->layout = L_NONE; |
79 | c->workspace_layout = L_NONE; | 79 | c->workspace_layout = L_NONE; |
80 | c->type = type; | 80 | c->type = type; |
81 | c->alpha = 1.0f; | ||
82 | |||
81 | if (type != C_VIEW) { | 83 | if (type != C_VIEW) { |
82 | c->children = create_list(); | 84 | c->children = create_list(); |
83 | } | 85 | } |
@@ -416,51 +418,33 @@ struct sway_container *container_at(struct sway_container *parent, | |||
416 | double view_sx = ox - swayc->x; | 418 | double view_sx = ox - swayc->x; |
417 | double view_sy = oy - swayc->y; | 419 | double view_sy = oy - swayc->y; |
418 | 420 | ||
421 | double _sx, _sy; | ||
422 | struct wlr_surface *_surface; | ||
419 | switch (sview->type) { | 423 | switch (sview->type) { |
420 | case SWAY_WL_SHELL_VIEW: | 424 | case SWAY_VIEW_XWAYLAND: |
421 | break; | 425 | _surface = wlr_surface_surface_at(sview->surface, |
422 | case SWAY_XDG_SHELL_V6_VIEW: | 426 | view_sx, view_sy, &_sx, &_sy); |
423 | // the top left corner of the sway container is the | 427 | break; |
424 | // coordinate of the top left corner of the window geometry | 428 | case SWAY_VIEW_WL_SHELL: |
425 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; | 429 | _surface = wlr_wl_shell_surface_surface_at( |
426 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; | 430 | sview->wlr_wl_shell_surface, |
427 | 431 | view_sx, view_sy, &_sx, &_sy); | |
428 | // check for popups | 432 | break; |
429 | double popup_sx, popup_sy; | 433 | case SWAY_VIEW_XDG_SHELL_V6: |
430 | struct wlr_xdg_surface_v6 *popup = | 434 | // the top left corner of the sway container is the |
431 | wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, | 435 | // coordinate of the top left corner of the window geometry |
432 | view_sx, view_sy, &popup_sx, &popup_sy); | 436 | view_sx += sview->wlr_xdg_surface_v6->geometry.x; |
433 | 437 | view_sy += sview->wlr_xdg_surface_v6->geometry.y; | |
434 | if (popup) { | 438 | |
435 | *sx = view_sx - popup_sx; | 439 | _surface = wlr_xdg_surface_v6_surface_at( |
436 | *sy = view_sy - popup_sy; | 440 | sview->wlr_xdg_surface_v6, |
437 | *surface = popup->surface; | 441 | view_sx, view_sy, &_sx, &_sy); |
438 | return swayc; | 442 | break; |
439 | } | ||
440 | break; | ||
441 | case SWAY_XWAYLAND_VIEW: | ||
442 | break; | ||
443 | default: | ||
444 | break; | ||
445 | } | ||
446 | |||
447 | // check for subsurfaces | ||
448 | double sub_x, sub_y; | ||
449 | struct wlr_subsurface *subsurface = | ||
450 | wlr_surface_subsurface_at(sview->surface, | ||
451 | view_sx, view_sy, &sub_x, &sub_y); | ||
452 | if (subsurface) { | ||
453 | *sx = view_sx - sub_x; | ||
454 | *sy = view_sy - sub_y; | ||
455 | *surface = subsurface->surface; | ||
456 | return swayc; | ||
457 | } | 443 | } |
458 | 444 | if (_surface) { | |
459 | if (wlr_surface_point_accepts_input( | 445 | *sx = _sx; |
460 | sview->surface, view_sx, view_sy)) { | 446 | *sy = _sy; |
461 | *sx = view_sx; | 447 | *surface = _surface; |
462 | *sy = view_sy; | ||
463 | *surface = swayc->sway_view->surface; | ||
464 | return swayc; | 448 | return swayc; |
465 | } | 449 | } |
466 | } else { | 450 | } else { |