mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: Optimize the insertion position of the new window in the scrolling layout
This commit is contained in:
parent
575446f6e3
commit
e81ca5a6e5
1 changed files with 13 additions and 3 deletions
16
src/mango.c
16
src/mango.c
|
|
@ -1181,7 +1181,8 @@ void applyrules(Client *c) {
|
||||||
r->offsety);
|
r->offsety);
|
||||||
}
|
}
|
||||||
if (c->isfloating) {
|
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)
|
if (!c->isnosizehint)
|
||||||
client_set_size_bound(c);
|
client_set_size_bound(c);
|
||||||
}
|
}
|
||||||
|
|
@ -3478,6 +3479,7 @@ void // old fix to 0.5
|
||||||
mapnotify(struct wl_listener *listener, void *data) {
|
mapnotify(struct wl_listener *listener, void *data) {
|
||||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
Client *p = NULL;
|
Client *p = NULL;
|
||||||
|
Client *at_client;
|
||||||
Client *c = wl_container_of(listener, c, map);
|
Client *c = wl_container_of(listener, c, map);
|
||||||
/* Create scene tree for this client and its border */
|
/* Create scene tree for this client and its border */
|
||||||
c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
|
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))
|
if (new_is_master && selmon && !is_scroller_layout(selmon))
|
||||||
// tile at the top
|
// tile at the top
|
||||||
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
wl_list_insert(&clients, &c->link); // 新窗口是master,头部入栈
|
||||||
else if (selmon && is_scroller_layout(selmon) && center_select(selmon)) {
|
else if (selmon && is_scroller_layout(selmon) &&
|
||||||
Client *at_client = center_select(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;
|
at_client->link.next->prev = &c->link;
|
||||||
c->link.prev = &at_client->link;
|
c->link.prev = &at_client->link;
|
||||||
c->link.next = at_client->link.next;
|
c->link.next = at_client->link.next;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue