summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-01-27 23:36:37 -0600
committerzachir <zachir@librem.one>2022-01-27 23:36:37 -0600
commita1a3d30ef2024da4383b1d9b0ec1050ebc5cb577 (patch)
tree00f88f666cc84501a4ea44a16d2b590b59f18bfa
parent7363955531bee115bfa13d792eccdcb2dc16519e (diff)
dwm: upgrade to 6.3, add optimization
-rw-r--r--config.def.h2
-rw-r--r--config.h2
-rw-r--r--config.mk6
-rw-r--r--drw.c1
-rw-r--r--dwm.12
-rw-r--r--dwm.c36
6 files changed, 25 insertions, 24 deletions
diff --git a/config.def.h b/config.def.h
index a66fbe2..14c2bd3 100644
--- a/config.def.h
+++ b/config.def.h
@@ -59,6 +59,8 @@ static const Rule rules[] = {
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+
static int attachbelow = 1; /* 1 means attach after the currently active window */
#include "tcl.c"
diff --git a/config.h b/config.h
index f2f2281..644913b 100644
--- a/config.h
+++ b/config.h
@@ -97,6 +97,8 @@ static const Rule rules[] = {
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
+
static int attachbelow = 1; /* 1 means attach after the currently active window */
#include "tcl.c"
diff --git a/config.mk b/config.mk
index dbbc526..770b4e8 100644
--- a/config.mk
+++ b/config.mk
@@ -1,5 +1,5 @@
# dwm version
-VERSION = 6.2
+VERSION = 6.3
# Customize below to fit your system
@@ -26,9 +26,9 @@ INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res
# flags
-CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
-CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
+CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -O3 -march=native ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}
# Solaris
diff --git a/drw.c b/drw.c
index 8fd1ca4..4cdbcbe 100644
--- a/drw.c
+++ b/drw.c
@@ -95,6 +95,7 @@ drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
+ drw_fontset_free(drw->fonts);
free(drw);
}
diff --git a/dwm.1 b/dwm.1
index bf742fd..2da95f5 100644
--- a/dwm.1
+++ b/dwm.1
@@ -36,7 +36,7 @@ dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS
.TP
.B \-v
-prints version information to standard output, then exits.
+prints version information to stderr, then exits.
.SH USAGE
.SS Status bar
.TP
diff --git a/dwm.c b/dwm.c
index 7882132..9d8e65d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -231,7 +231,6 @@ static void monocle(Monitor *m);
static void motionnotify(XEvent *e);
static void movemouse(const Arg *arg);
static Client *nexttiled(Client *c);
-static void pop(Client *);
static Client *prevtiled(Client *c);
static void propertynotify(XEvent *e);
static void pushdown(const Arg *arg);
@@ -485,7 +484,7 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
- strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
+ strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol - 1);
if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m);
}
@@ -605,7 +604,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
- else if (ev->x > (x = selmon->ww - TEXTW(stext) + lrpad - getsystraywidth())) {
+ else if (ev->x > (x = selmon->ww - (int)TEXTW(stext) + lrpad - getsystraywidth())) {
click = ClkStatusText;
char *text = rawstext;
@@ -952,20 +951,23 @@ void
drawbar(Monitor *m)
{
int indn;
- int x, w, sw = 0, stw = 0;
+ int x, w, tw = 0, stw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
+ if (!m->showbar)
+ return;
+
if(showsystray && m == systraytomon(m))
stw = getsystraywidth();
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
- sw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
- drw_text(drw, m->ww - sw - stw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
+ tw = TEXTW(stext) - lrpad / 2 + 2; /* 2px right padding */
+ drw_text(drw, m->ww - tw - stw, 0, tw, bh, lrpad / 2 - 2, stext, 0);
}
resizebarwin(m);
@@ -994,7 +996,7 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
- if ((w = m->ww - sw - stw - x) > bh) {
+ if ((w = m->ww - tw - stw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
@@ -1113,7 +1115,7 @@ focusstack(const Arg *arg)
{
Client *c = NULL, *i;
- if (!selmon->sel)
+ if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
return;
if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
@@ -1564,15 +1566,6 @@ nexttiled(Client *c)
return c;
}
-void
-pop(Client *c)
-{
- detach(c);
- attach(c);
- focus(c);
- arrange(c->mon);
-}
-
Client *
prevtiled(Client *c) {
Client *p, *r;
@@ -2051,7 +2044,7 @@ setlayout(const Arg *arg)
selmon->sellt ^= 1;
if (arg && arg->v)
selmon->lt[selmon->sellt] = (Layout *)arg->v;
- strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
+ strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol - 1);
if (selmon->sel)
arrange(selmon);
else
@@ -2084,7 +2077,7 @@ setmfact(const Arg *arg)
if (!arg || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
- if (f < 0.1 || f > 0.9)
+ if (f < 0.05 || f > 0.95)
return;
selmon->mfact = f;
arrange(selmon);
@@ -2306,11 +2299,14 @@ tile(Monitor *m)
h = (m->wh - my) * (c->cfact / mfacts);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
my += HEIGHT(c);
+ if (my + HEIGHT(c) < m->wh)
+ my += HEIGHT(c);
mfacts -= c->cfact;
} else {
h = (m->wh - ty) * (c->cfact / sfacts);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- ty += HEIGHT(c);
+ if (ty + HEIGHT(c) < m->wh)
+ ty += HEIGHT(c);
sfacts -= c->cfact;
}
}