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