refactor: cleanup + improve focus

This commit is contained in:
DanyLE 2024-04-01 16:10:22 +02:00
parent f03edb1db7
commit 8945f8b345

View File

@ -13,6 +13,7 @@ void diyac_cursor_focus(struct diyac_server *server)
struct diyac_node_descriptor *desc = diyac_node_at(server,
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
struct diyac_layer_surface * layer;
struct diyac_view * root = NULL;
if(!desc)
{
return;
@ -21,7 +22,15 @@ void diyac_cursor_focus(struct diyac_server *server)
switch (desc->type)
{
case DIYAC_NODE_VIEW:
diyac_focus_view(desc->data, true);
root = diyac_get_root_view(desc->data);
if(root)
{
diyac_focus_view(root, true);
}
else
{
diyac_focus_view(desc->data, true);
}
break;
case DIYAC_NODE_LAYER_SURFACE:
layer = desc->data;