|
|
@ -1602,47 +1602,26 @@ void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface,
|
|
|
|
surface->geometry.y;
|
|
|
|
surface->geometry.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at(
|
|
|
|
struct wlr_surface *wlr_xdg_surface_v6_surface_at(
|
|
|
|
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
|
|
|
|
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
|
|
|
|
double *popup_sx, double *popup_sy) {
|
|
|
|
double *sub_x, double *sub_y) {
|
|
|
|
// XXX: I think this is so complicated because we're mixing geometry
|
|
|
|
|
|
|
|
// coordinates with surface coordinates. Input handling should only deal
|
|
|
|
|
|
|
|
// with surface coordinates.
|
|
|
|
|
|
|
|
struct wlr_xdg_popup_v6 *popup_state;
|
|
|
|
struct wlr_xdg_popup_v6 *popup_state;
|
|
|
|
wl_list_for_each(popup_state, &surface->popups, link) {
|
|
|
|
wl_list_for_each(popup_state, &surface->popups, link) {
|
|
|
|
struct wlr_xdg_surface_v6 *popup = popup_state->base;
|
|
|
|
struct wlr_xdg_surface_v6 *popup = popup_state->base;
|
|
|
|
|
|
|
|
|
|
|
|
double _popup_sx =
|
|
|
|
double popup_sx, popup_sy;
|
|
|
|
surface->geometry.x + popup_state->geometry.x;
|
|
|
|
wlr_xdg_surface_v6_popup_get_position(popup, &popup_sx, &popup_sy);
|
|
|
|
double _popup_sy =
|
|
|
|
|
|
|
|
surface->geometry.y + popup_state->geometry.y;
|
|
|
|
|
|
|
|
int popup_width = popup_state->geometry.width;
|
|
|
|
|
|
|
|
int popup_height = popup_state->geometry.height;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_surface_v6 *_popup =
|
|
|
|
|
|
|
|
wlr_xdg_surface_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) &&
|
|
|
|
struct wlr_surface *sub = wlr_xdg_surface_v6_surface_at(popup,
|
|
|
|
(sy > _popup_sy && sy < _popup_sy + popup_height)) {
|
|
|
|
sx - popup_sx + popup->geometry.x,
|
|
|
|
if (pixman_region32_contains_point(&popup->surface->current->input,
|
|
|
|
sy - popup_sy + popup->geometry.y,
|
|
|
|
sx - _popup_sx + popup->geometry.x,
|
|
|
|
sub_x, sub_y);
|
|
|
|
sy - _popup_sy + popup->geometry.y, NULL)) {
|
|
|
|
if (sub != NULL) {
|
|
|
|
*popup_sx = _popup_sx - popup->geometry.x;
|
|
|
|
return sub;
|
|
|
|
*popup_sy = _popup_sy - popup->geometry.y;
|
|
|
|
|
|
|
|
return popup;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
return wlr_surface_surface_at(surface->surface, sx, sy, sub_x, sub_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void wlr_xdg_popup_v6_get_anchor_point(struct wlr_xdg_popup_v6 *popup,
|
|
|
|
void wlr_xdg_popup_v6_get_anchor_point(struct wlr_xdg_popup_v6 *popup,
|
|
|
|