mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 08:51:27 +00:00
cursor: Simplify node_at_coords with scene_descriptor_find
This commit is contained in:
parent
3e7306489f
commit
4a3c13f1ba
|
@ -76,42 +76,30 @@ struct sway_node *node_at_coords(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine what container we clicked on
|
struct sway_container *con =
|
||||||
struct wlr_scene_node *current = scene_node;
|
scene_descriptor_find(scene_node, SWAY_SCENE_DESC_CONTAINER);
|
||||||
while (true) {
|
|
||||||
struct sway_container *con = scene_descriptor_try_get(current,
|
|
||||||
SWAY_SCENE_DESC_CONTAINER);
|
|
||||||
|
|
||||||
if (!con) {
|
if (con) {
|
||||||
struct sway_popup_desc *popup =
|
// If this condition succeeds, the container is currently in the
|
||||||
scene_descriptor_try_get(current, SWAY_SCENE_DESC_POPUP);
|
// process of being destroyed. In this case, ignore the container
|
||||||
if (popup && popup->view) {
|
if (con->view && !con->view->surface) {
|
||||||
con = popup->view->container;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (con && (!con->view || con->view->surface)) {
|
|
||||||
return &con->node;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_LAYER_SHELL)) {
|
|
||||||
// We don't want to feed through the current workspace on
|
|
||||||
// layer shells
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return &con->node;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we clicked on a layer shell or unmanaged xwayland we don't
|
||||||
|
// want to return the workspace node.
|
||||||
|
if (scene_descriptor_find(scene_node, SWAY_SCENE_DESC_LAYER_SHELL)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#if WLR_HAS_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
if (scene_descriptor_try_get(current, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) {
|
if (scene_descriptor_find(scene_node, SWAY_SCENE_DESC_XWAYLAND_UNMANAGED)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!current->parent) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
current = ¤t->parent->node;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we aren't on a container, determine what workspace we are on
|
// if we aren't on a container, determine what workspace we are on
|
||||||
|
|
Loading…
Reference in a new issue