diff options
-rw-r--r-- | include/sway/tree/view.h | 11 | ||||
-rw-r--r-- | sway/desktop/output.c | 11 | ||||
-rw-r--r-- | sway/desktop/wl_shell.c | 4 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 4 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 4 | ||||
-rw-r--r-- | sway/input/seat.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 68 |
7 files changed, 39 insertions, 65 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 4b84205e..f32ccc5a 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h @@ -59,11 +59,9 @@ struct sway_wl_shell_surface { }; enum sway_view_type { - SWAY_WL_SHELL_VIEW, - SWAY_XDG_SHELL_V6_VIEW, - SWAY_XWAYLAND_VIEW, - // Keep last - SWAY_VIEW_TYPES, + SWAY_VIEW_WL_SHELL, + SWAY_VIEW_XDG_SHELL_V6, + SWAY_VIEW_XWAYLAND, }; enum sway_view_prop { @@ -101,9 +99,6 @@ struct sway_view { struct sway_xwayland_surface *sway_xwayland_surface; struct sway_wl_shell_surface *sway_wl_shell_surface; }; - - // only used for unmanaged views (shell specific) - struct wl_list unmanaged_view_link; // sway_root::unmanaged_views }; struct sway_view *view_create(enum sway_view_type type, diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 6cf5da48..0e8a9485 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -188,7 +188,7 @@ static void render_view(struct sway_container *view, void *data) { } switch (sway_view->type) { - case SWAY_XDG_SHELL_V6_VIEW: { + case SWAY_VIEW_XDG_SHELL_V6: { int window_offset_x = view->sway_view->wlr_xdg_surface_v6->geometry.x; int window_offset_y = view->sway_view->wlr_xdg_surface_v6->geometry.y; render_surface(surface, wlr_output, when, @@ -197,15 +197,12 @@ static void render_view(struct sway_container *view, void *data) { when, view->x - window_offset_x, view->y - window_offset_y, 0, alpha); break; } - case SWAY_WL_SHELL_VIEW: + case SWAY_VIEW_WL_SHELL: render_wl_shell_surface(sway_view->wlr_wl_shell_surface, wlr_output, when, view->x, view->y, 0, alpha, false); break; - case SWAY_XWAYLAND_VIEW: - render_surface(surface, wlr_output, when, view->x, view->y, - 0, alpha); - break; - default: + case SWAY_VIEW_XWAYLAND: + render_surface(surface, wlr_output, when, view->x, view->y, 0, alpha); break; } } diff --git a/sway/desktop/wl_shell.c b/sway/desktop/wl_shell.c index 6528a397..a470674d 100644 --- a/sway/desktop/wl_shell.c +++ b/sway/desktop/wl_shell.c @@ -12,7 +12,7 @@ #include "log.h" static bool assert_wl_shell(struct sway_view *view) { - return sway_assert(view->type == SWAY_WL_SHELL_VIEW, + return sway_assert(view->type == SWAY_VIEW_WL_SHELL, "Expecting wl_shell view!"); } @@ -97,7 +97,7 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) { return; } - struct sway_view *view = view_create(SWAY_WL_SHELL_VIEW, &view_impl); + struct sway_view *view = view_create(SWAY_VIEW_WL_SHELL, &view_impl); if (!sway_assert(view, "Failed to allocate view")) { return; } diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 49305b39..5cdb8f9f 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -12,7 +12,7 @@ #include "log.h" static bool assert_xdg(struct sway_view *view) { - return sway_assert(view->type == SWAY_XDG_SHELL_V6_VIEW, + return sway_assert(view->type == SWAY_VIEW_XDG_SHELL_V6, "Expected xdg shell v6 view!"); } @@ -126,7 +126,7 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) { return; } - struct sway_view *view = view_create(SWAY_XDG_SHELL_V6_VIEW, &view_impl); + struct sway_view *view = view_create(SWAY_VIEW_XDG_SHELL_V6, &view_impl); if (!sway_assert(view, "Failed to allocate view")) { return; } diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index bfef68cf..a793928c 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -42,7 +42,7 @@ static void create_unmanaged(struct wlr_xwayland_surface *xsurface) { static bool assert_xwayland(struct sway_view *view) { - return sway_assert(view->type == SWAY_XWAYLAND_VIEW, + return sway_assert(view->type == SWAY_VIEW_XWAYLAND, "Expected xwayland view!"); } @@ -185,7 +185,7 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) { return; } - struct sway_view *view = view_create(SWAY_XWAYLAND_VIEW, &view_impl); + struct sway_view *view = view_create(SWAY_VIEW_XWAYLAND, &view_impl); if (!sway_assert(view, "Failed to allocate view")) { return; } diff --git a/sway/input/seat.c b/sway/input/seat.c index 0699324a..87dbd870 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -66,7 +66,7 @@ static void seat_send_focus(struct sway_seat *seat, return; } struct sway_view *view = con->sway_view; - if (view->type == SWAY_XWAYLAND_VIEW) { + if (view->type == SWAY_VIEW_XWAYLAND) { struct wlr_xwayland *xwayland = seat->input->server->xwayland; wlr_xwayland_set_seat(xwayland, seat->wlr_seat); 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, double view_sx = ox - swayc->x; double view_sy = oy - swayc->y; + double _sx, _sy; + struct wlr_surface *_surface; switch (sview->type) { - case SWAY_WL_SHELL_VIEW: - break; - case SWAY_XDG_SHELL_V6_VIEW: - // the top left corner of the sway container is the - // coordinate of the top left corner of the window geometry - view_sx += sview->wlr_xdg_surface_v6->geometry.x; - view_sy += sview->wlr_xdg_surface_v6->geometry.y; - - // check for popups - double popup_sx, popup_sy; - struct wlr_xdg_surface_v6 *popup = - wlr_xdg_surface_v6_popup_at(sview->wlr_xdg_surface_v6, - view_sx, view_sy, &popup_sx, &popup_sy); - - if (popup) { - *sx = view_sx - popup_sx; - *sy = view_sy - popup_sy; - *surface = popup->surface; - return swayc; - } - break; - case SWAY_XWAYLAND_VIEW: - break; - default: - break; - } - - // check for subsurfaces - double sub_x, sub_y; - struct wlr_subsurface *subsurface = - wlr_surface_subsurface_at(sview->surface, - view_sx, view_sy, &sub_x, &sub_y); - if (subsurface) { - *sx = view_sx - sub_x; - *sy = view_sy - sub_y; - *surface = subsurface->surface; - return swayc; + case SWAY_VIEW_XWAYLAND: + _surface = wlr_surface_surface_at(sview->surface, + view_sx, view_sy, &_sx, &_sy); + break; + case SWAY_VIEW_WL_SHELL: + _surface = wlr_wl_shell_surface_surface_at( + sview->wlr_wl_shell_surface, + view_sx, view_sy, &_sx, &_sy); + break; + case SWAY_VIEW_XDG_SHELL_V6: + // the top left corner of the sway container is the + // coordinate of the top left corner of the window geometry + view_sx += sview->wlr_xdg_surface_v6->geometry.x; + view_sy += sview->wlr_xdg_surface_v6->geometry.y; + + _surface = wlr_xdg_surface_v6_surface_at( + sview->wlr_xdg_surface_v6, + view_sx, view_sy, &_sx, &_sy); + break; } - - if (wlr_surface_point_accepts_input( - sview->surface, view_sx, view_sy)) { - *sx = view_sx; - *sy = view_sy; - *surface = swayc->sway_view->surface; + if (_surface) { + *sx = _sx; + *sy = _sy; + *surface = _surface; return swayc; } } else { |