mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-09 13:29:46 -05:00
commit
543601e86c
10 changed files with 1017 additions and 78 deletions
|
|
@ -51,6 +51,15 @@ void view_get_input_bounds(struct roots_view *view, struct wlr_box *box) {
|
|||
view->get_input_bounds(view, box);
|
||||
return;
|
||||
}
|
||||
|
||||
if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
|
||||
box->x = view->xdg_surface_v6->geometry->x;
|
||||
box->y = view->xdg_surface_v6->geometry->y;
|
||||
box->width = view->xdg_surface_v6->geometry->width;
|
||||
box->height = view->xdg_surface_v6->geometry->height;
|
||||
return;
|
||||
}
|
||||
|
||||
box->x = box->y = 0;
|
||||
box->width = view->wlr_surface->current->width;
|
||||
box->height = view->wlr_surface->current->height;
|
||||
|
|
@ -101,6 +110,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) {
|
||||
|
|
@ -122,6 +161,21 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
view_sy = ry + (double)box.height/2;
|
||||
}
|
||||
|
||||
if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
|
||||
// TODO: test if this works with rotated views
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue