fix: layer shell + view bugs
- fix bug that causes layer shell seat focus incorrect on layer windows - focus on a regular view now raises all views of the related applications on top of the output
This commit is contained in:
55
view.c
55
view.c
@ -63,6 +63,30 @@ static void raise_to_front(struct diyac_view *view)
|
||||
/* Activate the new surface */
|
||||
}
|
||||
|
||||
static void raise_all_views(struct diyac_view* view)
|
||||
{
|
||||
struct diyac_view* root = diyac_get_root_view(view);
|
||||
if (root)
|
||||
{
|
||||
raise_to_front(root);
|
||||
struct diyac_view **subview = NULL;
|
||||
struct wl_array subviews;
|
||||
wl_array_init(&subviews);
|
||||
diyac_get_children_views(root, &subviews);
|
||||
wl_array_for_each(subview, &subviews)
|
||||
{
|
||||
raise_to_front(*subview);
|
||||
}
|
||||
wl_array_release(&subviews);
|
||||
}
|
||||
else
|
||||
{
|
||||
raise_to_front(view);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void diyac_focus_view(struct diyac_view *toplevel, bool raise)
|
||||
{
|
||||
/* Note: this function only deals with keyboard focus. */
|
||||
@ -86,18 +110,13 @@ void diyac_focus_view(struct diyac_view *toplevel, bool raise)
|
||||
{
|
||||
diyac_view_set_activated(toplevel->server->active_view, false);
|
||||
}
|
||||
raise_to_front(toplevel);
|
||||
if (raise)
|
||||
{
|
||||
struct diyac_view **subview = NULL;
|
||||
struct wl_array subviews;
|
||||
wl_array_init(&subviews);
|
||||
diyac_get_children_views(toplevel, &subviews);
|
||||
wl_array_for_each(subview, &subviews)
|
||||
{
|
||||
raise_to_front(*subview);
|
||||
}
|
||||
wl_array_release(&subviews);
|
||||
raise_all_views(toplevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
raise_to_front(toplevel);
|
||||
}
|
||||
diyac_view_set_activated(toplevel, true);
|
||||
// diyac_seat_focus_surface(&server->seat, toplevel->xdg_toplevel->base->surface);
|
||||
@ -256,7 +275,12 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed)
|
||||
view->pending_size = view->original;
|
||||
}
|
||||
}
|
||||
|
||||
view->state = view->requested;
|
||||
if((view->state.maximized || view->state.fullscreen) && !wlr_box_equal(&usable, &view->original))
|
||||
{
|
||||
diyac_view_configure(view, usable);
|
||||
return true;
|
||||
}
|
||||
// if (wlr_output_layout_intersects(view->server->output_layout,
|
||||
// view->output->wlr_output, &view->current))
|
||||
//{
|
||||
@ -301,7 +325,6 @@ bool diyac_view_update_geometry(struct diyac_view *view, bool grabbed)
|
||||
geometry.y = usable.y + usable.height - server->grab_y;
|
||||
}
|
||||
}
|
||||
view->state = view->requested;
|
||||
if (!wlr_box_equal(&geometry, &view->original) || !view->requested.maximized)
|
||||
{
|
||||
wlr_log(WLR_DEBUG, "diyac_view_update_geometry: updating geometry: %d %d %d %d", geometry.x, geometry.y, geometry.width, geometry.height);
|
||||
@ -323,7 +346,7 @@ void diyac_get_children_views(struct diyac_view *view, struct wl_array *children
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!child->mapped /*&& !view->minimized*/)
|
||||
if (!child->mapped || view->state.minimized)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -488,3 +511,9 @@ void diyac_view_sync_geo(struct diyac_view *view)
|
||||
wlr_scene_node_set_position(&view->scene_tree->node, next_x, next_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void diya_view_unfocus(struct diyac_view* view)
|
||||
{
|
||||
diyac_view_set_activated(view, false);
|
||||
}
|
Reference in New Issue
Block a user