diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-04 22:00:50 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 22:00:50 -0400 |
commit | 9a30a4f557c895e3d9ed9be19813ce43f05e00cb (patch) | |
tree | 2694e174b09d31820fe0fa80195cf8473f0bfb0b /rootston | |
parent | cdb025a74bb7b36a5cee6fffa6eb0c414af8be71 (diff) | |
parent | 3ea425d4e232d4d03506e7177b0c25d9d964956d (diff) |
Merge pull request #824 from emersion/fix-subsurface-at
Redesign surface input functions
Diffstat (limited to 'rootston')
-rw-r--r-- | rootston/desktop.c | 67 |
1 files changed, 24 insertions, 43 deletions
diff --git a/rootston/desktop.c b/rootston/desktop.c index f6801332..e9c1ed30 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -577,42 +577,30 @@ 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 sub_x, sub_y; - struct wlr_subsurface *subsurface = - wlr_surface_subsurface_at(view->wlr_surface, - view_sx, view_sy, &sub_x, &sub_y); - if (subsurface) { - *sx = view_sx - sub_x; - *sy = view_sy - sub_y; - *surface = subsurface->surface; + double _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_XDG_SHELL_VIEW: + _surface = wlr_xdg_surface_surface_at(view->xdg_surface, + 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: + _surface = wlr_surface_surface_at(view->wlr_surface, + view_sx, view_sy, &_sx, &_sy); + break; + } + if (_surface != NULL) { + *sx = _sx; + *sy = _sy; + *surface = _surface; return true; } @@ -623,13 +611,6 @@ static bool view_at(struct roots_view *view, double lx, double ly, return true; } - if (wlr_surface_point_accepts_input(view->wlr_surface, view_sx, view_sy)) { - *sx = view_sx; - *sy = view_sy; - *surface = view->wlr_surface; - return true; - } - return false; } |