merged deck

This commit is contained in:
2025-04-06 00:17:29 +02:00
3 changed files with 125 additions and 0 deletions

36
dwl.c
View File

@@ -279,6 +279,7 @@ static void createpopup(struct wl_listener *listener, void *data);
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
static void cursorframe(struct wl_listener *listener, void *data);
static void cursorwarptohint(void);
static void deck(Monitor *m);
static void destroydecoration(struct wl_listener *listener, void *data);
static void destroydragicon(struct wl_listener *listener, void *data);
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
@@ -1263,6 +1264,41 @@ cursorwarptohint(void)
}
}
void
deck(Monitor *m)
{
unsigned int mw, my;
int i, n = 0;
Client *c;
wl_list_for_each(c, &clients, link)
if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
n++;
if (n == 0)
return;
if (n > m->nmaster)
mw = m->nmaster ? round(m->w.width * m->mfact) : 0;
else
mw = m->w.width;
i = my = 0;
wl_list_for_each(c, &clients, link) {
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
continue;
if (i < m->nmaster) {
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
my += c->geom.height;
} else {
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y,
.width = m->w.width - mw, .height = m->w.height}, 0);
if (c == focustop(m))
wlr_scene_node_raise_to_top(&c->scene->node);
}
i++;
}
}
void
destroydecoration(struct wl_listener *listener, void *data)
{