|
|
|
@ -93,6 +93,36 @@ static struct wlr_subsurface *subsurface_at(struct wlr_surface *surface,
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static struct wlr_xdg_surface_v6 *xdg_v6_popup_at(
|
|
|
|
|
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
|
|
|
|
|
double *popup_sx, double *popup_sy) {
|
|
|
|
|
struct wlr_xdg_surface_v6 *popup;
|
|
|
|
|
wl_list_for_each(popup, &surface->popups, popup_link) {
|
|
|
|
|
double _popup_sx = surface->geometry->x + popup->popup_state->geometry.x;
|
|
|
|
|
double _popup_sy = surface->geometry->y + popup->popup_state->geometry.y;
|
|
|
|
|
int popup_width = popup->popup_state->geometry.width;
|
|
|
|
|
int popup_height = popup->popup_state->geometry.height;
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_surface_v6 *_popup =
|
|
|
|
|
xdg_v6_popup_at(popup, sx - _popup_sx + popup->geometry->x,
|
|
|
|
|
sy - _popup_sy + popup->geometry->y, popup_sx, popup_sy);
|
|
|
|
|
if (_popup) {
|
|
|
|
|
*popup_sx = *popup_sx + _popup_sx - popup->geometry->x;
|
|
|
|
|
*popup_sy = *popup_sy + _popup_sy - popup->geometry->y;
|
|
|
|
|
return _popup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((sx > _popup_sx && sx < _popup_sx + popup_width) &&
|
|
|
|
|
(sy > _popup_sy && sy < _popup_sy + popup_height)) {
|
|
|
|
|
*popup_sx = _popup_sx - popup->geometry->x;
|
|
|
|
|
*popup_sy = _popup_sy - popup->geometry->y;
|
|
|
|
|
return popup;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|
|
|
|
struct wlr_surface **surface, double *sx, double *sy) {
|
|
|
|
|
for (int i = desktop->views->length - 1; i >= 0; --i) {
|
|
|
|
@ -101,6 +131,20 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|
|
|
|
double view_sx = lx - view->x;
|
|
|
|
|
double view_sy = ly - view->y;
|
|
|
|
|
|
|
|
|
|
if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
|
|
|
|
|
double popup_sx, popup_sy;
|
|
|
|
|
struct wlr_xdg_surface_v6 *popup =
|
|
|
|
|
xdg_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 view;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double sub_x, sub_y;
|
|
|
|
|
struct wlr_subsurface *subsurface =
|
|
|
|
|
subsurface_at(view->wlr_surface, view_sx, view_sy, &sub_x, &sub_y);
|
|
|
|
|