|
|
@ -151,10 +151,10 @@ struct sway_container *container_find_child(struct sway_container *container,
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void surface_at_view(struct sway_container *con, double lx, double ly,
|
|
|
|
static struct sway_container *surface_at_view(struct sway_container *con, double lx, double ly,
|
|
|
|
struct wlr_surface **surface, double *sx, double *sy) {
|
|
|
|
struct wlr_surface **surface, double *sx, double *sy) {
|
|
|
|
if (!sway_assert(con->view, "Expected a view")) {
|
|
|
|
if (!sway_assert(con->view, "Expected a view")) {
|
|
|
|
return;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct sway_view *view = con->view;
|
|
|
|
struct sway_view *view = con->view;
|
|
|
|
double view_sx = lx - view->x + view->geometry.x;
|
|
|
|
double view_sx = lx - view->x + view->geometry.x;
|
|
|
@ -184,7 +184,9 @@ static void surface_at_view(struct sway_container *con, double lx, double ly,
|
|
|
|
*sx = _sx;
|
|
|
|
*sx = _sx;
|
|
|
|
*sy = _sy;
|
|
|
|
*sy = _sy;
|
|
|
|
*surface = _surface;
|
|
|
|
*surface = _surface;
|
|
|
|
|
|
|
|
return con;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -355,37 +357,31 @@ struct sway_container *container_at(struct sway_workspace *workspace,
|
|
|
|
double lx, double ly,
|
|
|
|
double lx, double ly,
|
|
|
|
struct wlr_surface **surface, double *sx, double *sy) {
|
|
|
|
struct wlr_surface **surface, double *sx, double *sy) {
|
|
|
|
struct sway_container *c;
|
|
|
|
struct sway_container *c;
|
|
|
|
|
|
|
|
|
|
|
|
// Focused view's popups
|
|
|
|
// Focused view's popups
|
|
|
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
|
|
|
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
|
|
|
struct sway_container *focus = seat_get_focused_container(seat);
|
|
|
|
struct sway_container *focus = seat_get_focused_container(seat);
|
|
|
|
bool is_floating = focus && container_is_floating_or_child(focus);
|
|
|
|
bool is_floating = focus && container_is_floating_or_child(focus);
|
|
|
|
// Focused view's popups
|
|
|
|
// Focused view's popups
|
|
|
|
if (focus && focus->view) {
|
|
|
|
if (focus && focus->view) {
|
|
|
|
surface_at_view(focus, lx, ly, surface, sx, sy);
|
|
|
|
c = surface_at_view(focus, lx, ly, surface, sx, sy);
|
|
|
|
if (*surface && surface_is_popup(*surface)) {
|
|
|
|
if (c && surface_is_popup(*surface)) {
|
|
|
|
return focus;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*surface = NULL;
|
|
|
|
*surface = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If focused is floating, focused view's non-popups
|
|
|
|
// Cast a ray to handle floating windows
|
|
|
|
if (focus && focus->view && is_floating) {
|
|
|
|
for (int i = workspace->floating->length - 1; i >= 0; --i) {
|
|
|
|
surface_at_view(focus, lx, ly, surface, sx, sy);
|
|
|
|
struct sway_container *cn = workspace->floating->items[i];
|
|
|
|
if (*surface) {
|
|
|
|
if (cn->view && (c = surface_at_view(cn, lx, ly, surface, sx, sy))) {
|
|
|
|
return focus;
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*surface = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Floating (non-focused)
|
|
|
|
|
|
|
|
if ((c = floating_container_at(lx, ly, surface, sx, sy))) {
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If focused is tiling, focused view's non-popups
|
|
|
|
// If focused is tiling, focused view's non-popups
|
|
|
|
if (focus && focus->view && !is_floating) {
|
|
|
|
if (focus && focus->view && !is_floating) {
|
|
|
|
surface_at_view(focus, lx, ly, surface, sx, sy);
|
|
|
|
if ((c = surface_at_view(focus, lx, ly, surface, sx, sy))) {
|
|
|
|
if (*surface) {
|
|
|
|
return c;
|
|
|
|
return focus;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*surface = NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Tiling (non-focused)
|
|
|
|
// Tiling (non-focused)
|
|
|
|
if ((c = tiling_container_at(&workspace->node, lx, ly, surface, sx, sy))) {
|
|
|
|
if ((c = tiling_container_at(&workspace->node, lx, ly, surface, sx, sy))) {
|
|
|
|