apply cfacts patch
parent
df9d70e011
commit
5afee4099e
|
|
@ -130,6 +130,9 @@ static const Key keys[] = {
|
|||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XKB_KEY_H, setcfact, {.f = +0.25} },
|
||||
{ MODKEY, XKB_KEY_L, setcfact, {.f = -0.25} },
|
||||
{ MODKEY, XKB_KEY_K, setcfact, {.f = 0} },
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
|
|
|
|||
30
dwl.c
30
dwl.c
|
|
@ -128,6 +128,7 @@ typedef struct {
|
|||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
float cweight;
|
||||
} Client;
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -314,6 +315,7 @@ static void rendermon(struct wl_listener *listener, void *data);
|
|||
static void requeststartdrag(struct wl_listener *listener, void *data);
|
||||
static void resize(Client *c, struct wlr_box geo, int interact, int draw_borders);
|
||||
static void run(char *startup_cmd);
|
||||
static void setcfact(const Arg *arg);
|
||||
static void setcursor(struct wl_listener *listener, void *data);
|
||||
static void setfloating(Client *c, int floating);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
|
|
@ -1107,6 +1109,7 @@ createnotify(struct wl_listener *listener, void *data)
|
|||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
||||
c->surface.xdg = xdg_surface;
|
||||
c->bw = borderpx;
|
||||
c->cweight = 1.0;
|
||||
|
||||
LISTEN(&xdg_surface->events.map, &c->map, mapnotify);
|
||||
LISTEN(&xdg_surface->events.unmap, &c->unmap, unmapnotify);
|
||||
|
|
@ -2359,6 +2362,17 @@ run(char *startup_cmd)
|
|||
wl_display_run(dpy);
|
||||
}
|
||||
|
||||
void
|
||||
setcfact(const Arg *arg)
|
||||
{
|
||||
Client *sel = focustop(selmon);
|
||||
|
||||
if(!arg || !sel || !selmon->lt[selmon->sellt]->arrange)
|
||||
return;
|
||||
sel->cweight = arg->f ? sel->cweight + arg->f : 1.0;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
void
|
||||
setcursor(struct wl_listener *listener, void *data)
|
||||
{
|
||||
|
|
@ -2736,6 +2750,7 @@ void
|
|||
tile(Monitor *m)
|
||||
{
|
||||
unsigned int i, n = 0, mw, my, ty, draw_borders = 1;
|
||||
float mweight = 0, tweight = 0;
|
||||
Client *c;
|
||||
|
||||
wl_list_for_each(c, &clients, link)
|
||||
|
|
@ -2751,17 +2766,27 @@ tile(Monitor *m)
|
|||
mw = m->nmaster ? m->w.width * m->mfact : 0;
|
||||
else
|
||||
mw = m->w.width;
|
||||
i = 0;
|
||||
wl_list_for_each(c, &clients, link){
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster)
|
||||
mweight += c->cweight;
|
||||
else
|
||||
tweight += c->cweight;
|
||||
i++;
|
||||
}
|
||||
i = my = ty = 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, draw_borders);
|
||||
.height = ((c->cweight / mweight) * m->w.height)}, 0, draw_borders);
|
||||
my += c->geom.height;
|
||||
} else {
|
||||
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
||||
.width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0, draw_borders);
|
||||
.width = m->w.width - mw, .height = ((c->cweight / tweight) * m->w.height) }, 0, draw_borders);
|
||||
ty += c->geom.height;
|
||||
}
|
||||
i++;
|
||||
|
|
@ -3212,6 +3237,7 @@ createnotifyx11(struct wl_listener *listener, void *data)
|
|||
c->surface.xwayland = xsurface;
|
||||
c->type = xsurface->override_redirect ? X11Unmanaged : X11Managed;
|
||||
c->bw = borderpx;
|
||||
c->cweight = 1.0;
|
||||
|
||||
/* Listen to the various events it can emit */
|
||||
LISTEN(&xsurface->events.map, &c->map, mapnotify);
|
||||
|
|
|
|||
Loading…
Reference in New Issue