improvement on xdg request handles

This commit is contained in:
DanyLE
2024-04-01 22:12:35 +02:00
parent 8945f8b345
commit 0d84bd388c
8 changed files with 83 additions and 46 deletions

21
view.c
View File

@ -21,11 +21,17 @@ void diyac_focus_view(struct diyac_view *toplevel, bool raise)
{
return;
}
if(!toplevel->mapped)
{
// dont focus unmapped view
return;
}
struct diyac_server *server = toplevel->server;
struct wlr_surface *prev_surface = server->seat.wlr_seat->keyboard_state.focused_surface;
if (prev_surface == toplevel->xdg_toplevel->base->surface)
{
// Don't re-focus an already focused surface.
wlr_log(WLR_DEBUG, "Don't re-focus an already focused surface");
return;
}
if (prev_surface)
@ -42,10 +48,6 @@ void diyac_focus_view(struct diyac_view *toplevel, bool raise)
wlr_xdg_toplevel_set_activated(prev_toplevel, false);
}
}
if(!toplevel->mapped)
{
return;
}
raise_to_front(toplevel);
if (raise)
{
@ -80,11 +82,20 @@ struct diyac_view *diyac_view_at(
return node_descriptor->data;
}
void diyac_focus_topmost_view(struct diyac_server *server)
void diyac_focus_topmost_view(struct diyac_server *server, bool raise)
{
struct diyac_view *view = diyac_topmost_focusable_view(server);
if (view)
{
if(raise)
{
struct diyac_view * root = diyac_get_root_view(view);
if(root)
{
diyac_focus_view(root, true);
return;
}
}
diyac_focus_view(view, false);
}
else