From c9d21106b4ea85558db06c8e0bff4c6e3fbc203e Mon Sep 17 00:00:00 2001 From: emersion Date: Wed, 4 Apr 2018 17:42:16 -0400 Subject: Add wlr_xdg_surface_v6_surface_at and wlr_wl_shell_surface_surface_at --- rootston/desktop.c | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) (limited to 'rootston/desktop.c') diff --git a/rootston/desktop.c b/rootston/desktop.c index cfeb809b..e2127764 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -577,37 +577,23 @@ static bool view_at(struct roots_view *view, double lx, double ly, view_sy = ry + (double)box.height/2; } - if (view->type == ROOTS_XDG_SHELL_V6_VIEW) { - double popup_sx, popup_sy; - struct wlr_xdg_surface_v6 *popup = - wlr_xdg_surface_v6_popup_at(view->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 true; - } - } - - if (view->type == ROOTS_WL_SHELL_VIEW) { - double popup_sx, popup_sy; - struct wlr_wl_shell_surface *popup = - wlr_wl_shell_surface_popup_at(view->wl_shell_surface, - view_sx, view_sy, &popup_sx, &popup_sy); - - if (popup) { - *sx = view_sx - popup_sx; - *sy = view_sy - popup_sy; - *surface = popup->surface; - return true; - } - } - double _sx, _sy; - struct wlr_surface *_surface = wlr_surface_surface_at(view->wlr_surface, - view_sx, view_sy, &_sx, &_sy); + struct wlr_surface *_surface; + switch (view->type) { + case ROOTS_XDG_SHELL_V6_VIEW: + _surface = wlr_xdg_surface_v6_surface_at(view->xdg_surface_v6, + view_sx, view_sy, &_sx, &_sy); + break; + case ROOTS_WL_SHELL_VIEW: + _surface = wlr_wl_shell_surface_surface_at(view->wl_shell_surface, + view_sx, view_sy, &_sx, &_sy); + break; + case ROOTS_XWAYLAND_VIEW: + case ROOTS_XDG_SHELL_VIEW: // TODO + _surface = wlr_surface_surface_at(view->wlr_surface, + view_sx, view_sy, &_sx, &_sy); + break; + } if (_surface != NULL) { *sx = _sx; *sy = _sy; -- cgit v1.2.3