aboutsummaryrefslogtreecommitdiff
path: root/rootston/desktop.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-04 17:42:16 -0400
committeremersion <contact@emersion.fr>2018-04-04 17:42:16 -0400
commitc9d21106b4ea85558db06c8e0bff4c6e3fbc203e (patch)
tree99dc2d1061e4e6233a18ef7e86205c7005ca0f86 /rootston/desktop.c
parent1a8b24bdd268a13bd2977356d6f2e872260709c3 (diff)
Add wlr_xdg_surface_v6_surface_at and wlr_wl_shell_surface_surface_at
Diffstat (limited to 'rootston/desktop.c')
-rw-r--r--rootston/desktop.c46
1 files changed, 16 insertions, 30 deletions
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;