opt: Optimize the insertion position of the new window in the scrolling layout

This commit is contained in:
DreamMaoMao 2025-09-07 09:47:36 +08:00
parent 575446f6e3
commit e81ca5a6e5

View file

@ -1181,7 +1181,8 @@ void applyrules(Client *c) {
r->offsety);
}
if (c->isfloating) {
c->geom = c->oldgeom.width> 0 && c->oldgeom.height > 0 ? c->oldgeom : c->geom;
c->geom = c->oldgeom.width > 0 && c->oldgeom.height > 0 ? c->oldgeom
: c->geom;
if (!c->isnosizehint)
client_set_size_bound(c);
}
@ -3478,6 +3479,7 @@ void // old fix to 0.5
mapnotify(struct wl_listener *listener, void *data) {
/* Called when the surface is mapped, or ready to display on-screen. */
Client *p = NULL;
Client *at_client;
Client *c = wl_container_of(listener, c, map);
/* Create scene tree for this client and its border */
c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
@ -3545,8 +3547,16 @@ mapnotify(struct wl_listener *listener, void *data) {
if (new_is_master && selmon && !is_scroller_layout(selmon))
// tile at the top
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
else if (selmon && is_scroller_layout(selmon) && center_select(selmon)) {
Client *at_client = center_select(selmon);
else if (selmon && is_scroller_layout(selmon) &&
selmon->visible_tiling_clients > 0) {
if (selmon->sel && ISTILED(selmon->sel) &&
VISIBLEON(selmon->sel, selmon)) {
at_client = selmon->sel;
} else {
at_client = center_select(selmon);
}
at_client->link.next->prev = &c->link;
c->link.prev = &at_client->link;
c->link.next = at_client->link.next;