sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-nostatusbar-6.2.diff (27178B)


      1 From 8e8d077d6aef1ed1969f30eb66931d56afba3599 Mon Sep 17 00:00:00 2001
      2 From: aleks <aleks.stier@icloud.com>
      3 Date: Thu, 27 Jun 2019 15:41:56 +0200
      4 Subject: [PATCH] Remove statusbar and all related code
      5 
      6 ---
      7  config.def.h |  16 +--
      8  drw.c        | 304 ---------------------------------------------------
      9  drw.h        |   8 --
     10  dwm.c        | 207 +----------------------------------
     11  4 files changed, 9 insertions(+), 526 deletions(-)
     12 
     13 diff --git a/config.def.h b/config.def.h
     14 index 1c0b587..a62df75 100644
     15 --- a/config.def.h
     16 +++ b/config.def.h
     17 @@ -3,9 +3,6 @@
     18  /* appearance */
     19  static const unsigned int borderpx  = 1;        /* border pixel of windows */
     20  static const unsigned int snap      = 32;       /* snap pixel */
     21 -static const int showbar            = 1;        /* 0 means no bar */
     22 -static const int topbar             = 1;        /* 0 means bottom bar */
     23 -static const char *fonts[]          = { "monospace:size=10" };
     24  static const char dmenufont[]       = "monospace:size=10";
     25  static const char col_gray1[]       = "#222222";
     26  static const char col_gray2[]       = "#444444";
     27 @@ -18,6 +15,7 @@ static const char *colors[][3]      = {
     28  	[SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
     29  };
     30  
     31 +/* TODO replace array with int */
     32  /* tagging */
     33  static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     34  
     35 @@ -36,6 +34,7 @@ static const float mfact     = 0.55; /* factor of master area size [0.05..0.95]
     36  static const int nmaster     = 1;    /* number of clients in master area */
     37  static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     38  
     39 +/* TODO remove symbols */
     40  static const Layout layouts[] = {
     41  	/* symbol     arrange function */
     42  	{ "[]=",      tile },    /* first entry is default */
     43 @@ -63,7 +62,6 @@ static Key keys[] = {
     44  	/* modifier                     key        function        argument */
     45  	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     46  	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
     47 -	{ MODKEY,                       XK_b,      togglebar,      {0} },
     48  	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
     49  	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
     50  	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
     51 @@ -97,19 +95,11 @@ static Key keys[] = {
     52  };
     53  
     54  /* button definitions */
     55 -/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
     56 +/* click can be ClkClientWin or ClkRootWin */
     57  static Button buttons[] = {
     58  	/* click                event mask      button          function        argument */
     59 -	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
     60 -	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
     61 -	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
     62 -	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
     63  	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
     64  	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
     65  	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
     66 -	{ ClkTagBar,            0,              Button1,        view,           {0} },
     67 -	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
     68 -	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
     69 -	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
     70  };
     71  
     72 diff --git a/drw.c b/drw.c
     73 index 8fd1ca4..c9b796f 100644
     74 --- a/drw.c
     75 +++ b/drw.c
     76 @@ -11,55 +11,6 @@
     77  #define UTF_INVALID 0xFFFD
     78  #define UTF_SIZ     4
     79  
     80 -static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80,    0, 0xC0, 0xE0, 0xF0};
     81 -static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
     82 -static const long utfmin[UTF_SIZ + 1] = {       0,    0,  0x80,  0x800,  0x10000};
     83 -static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
     84 -
     85 -static long
     86 -utf8decodebyte(const char c, size_t *i)
     87 -{
     88 -	for (*i = 0; *i < (UTF_SIZ + 1); ++(*i))
     89 -		if (((unsigned char)c & utfmask[*i]) == utfbyte[*i])
     90 -			return (unsigned char)c & ~utfmask[*i];
     91 -	return 0;
     92 -}
     93 -
     94 -static size_t
     95 -utf8validate(long *u, size_t i)
     96 -{
     97 -	if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
     98 -		*u = UTF_INVALID;
     99 -	for (i = 1; *u > utfmax[i]; ++i)
    100 -		;
    101 -	return i;
    102 -}
    103 -
    104 -static size_t
    105 -utf8decode(const char *c, long *u, size_t clen)
    106 -{
    107 -	size_t i, j, len, type;
    108 -	long udecoded;
    109 -
    110 -	*u = UTF_INVALID;
    111 -	if (!clen)
    112 -		return 0;
    113 -	udecoded = utf8decodebyte(c[0], &len);
    114 -	if (!BETWEEN(len, 1, UTF_SIZ))
    115 -		return 1;
    116 -	for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
    117 -		udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
    118 -		if (type)
    119 -			return j;
    120 -	}
    121 -	if (j < len)
    122 -		return 0;
    123 -	*u = udecoded;
    124 -	utf8validate(u, len);
    125 -
    126 -	return len;
    127 -}
    128 -
    129  Drw *
    130  drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
    131  {
    132 @@ -98,100 +49,6 @@ drw_free(Drw *drw)
    133  	free(drw);
    134  }
    135  
    136 -/* This function is an implementation detail. Library users should use
    137 - * drw_fontset_create instead.
    138 - */
    139 -static Fnt *
    140 -xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
    141 -{
    142 -	Fnt *font;
    143 -	XftFont *xfont = NULL;
    144 -	FcPattern *pattern = NULL;
    145 -
    146 -	if (fontname) {
    147 -		/* Using the pattern found at font->xfont->pattern does not yield the
    148 -		 * same substitution results as using the pattern returned by
    149 -		 * FcNameParse; using the latter results in the desired fallback
    150 -		 * behaviour whereas the former just results in missing-character
    151 -		 * rectangles being drawn, at least with some fonts. */
    152 -		if (!(xfont = XftFontOpenName(drw->dpy, drw->screen, fontname))) {
    153 -			fprintf(stderr, "error, cannot load font from name: '%s'\n", fontname);
    154 -			return NULL;
    155 -		}
    156 -		if (!(pattern = FcNameParse((FcChar8 *) fontname))) {
    157 -			fprintf(stderr, "error, cannot parse font name to pattern: '%s'\n", fontname);
    158 -			XftFontClose(drw->dpy, xfont);
    159 -			return NULL;
    160 -		}
    161 -	} else if (fontpattern) {
    162 -		if (!(xfont = XftFontOpenPattern(drw->dpy, fontpattern))) {
    163 -			fprintf(stderr, "error, cannot load font from pattern.\n");
    164 -			return NULL;
    165 -		}
    166 -	} else {
    167 -		die("no font specified.");
    168 -	}
    169 -
    170 -	/* Do not allow using color fonts. This is a workaround for a BadLength
    171 -	 * error from Xft with color glyphs. Modelled on the Xterm workaround. See
    172 -	 * https://bugzilla.redhat.com/show_bug.cgi?id=1498269
    173 -	 * https://lists.suckless.org/dev/1701/30932.html
    174 -	 * https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
    175 -	 * and lots more all over the internet.
    176 -	 */
    177 -	FcBool iscol;
    178 -	if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
    179 -		XftFontClose(drw->dpy, xfont);
    180 -		return NULL;
    181 -	}
    182 -
    183 -	font = ecalloc(1, sizeof(Fnt));
    184 -	font->xfont = xfont;
    185 -	font->pattern = pattern;
    186 -	font->h = xfont->ascent + xfont->descent;
    187 -	font->dpy = drw->dpy;
    188 -
    189 -	return font;
    190 -}
    191 -
    192 -static void
    193 -xfont_free(Fnt *font)
    194 -{
    195 -	if (!font)
    196 -		return;
    197 -	if (font->pattern)
    198 -		FcPatternDestroy(font->pattern);
    199 -	XftFontClose(font->dpy, font->xfont);
    200 -	free(font);
    201 -}
    202 -
    203 -Fnt*
    204 -drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount)
    205 -{
    206 -	Fnt *cur, *ret = NULL;
    207 -	size_t i;
    208 -
    209 -	if (!drw || !fonts)
    210 -		return NULL;
    211 -
    212 -	for (i = 1; i <= fontcount; i++) {
    213 -		if ((cur = xfont_create(drw, fonts[fontcount - i], NULL))) {
    214 -			cur->next = ret;
    215 -			ret = cur;
    216 -		}
    217 -	}
    218 -	return (drw->fonts = ret);
    219 -}
    220 -
    221 -void
    222 -drw_fontset_free(Fnt *font)
    223 -{
    224 -	if (font) {
    225 -		drw_fontset_free(font->next);
    226 -		xfont_free(font);
    227 -	}
    228 -}
    229 -
    230  void
    231  drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
    232  {
    233 @@ -221,13 +78,6 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
    234  	return ret;
    235  }
    236  
    237 -void
    238 -drw_setfontset(Drw *drw, Fnt *set)
    239 -{
    240 -	if (drw)
    241 -		drw->fonts = set;
    242 -}
    243 -
    244  void
    245  drw_setscheme(Drw *drw, Clr *scm)
    246  {
    247 @@ -247,137 +97,6 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
    248  		XDrawRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w - 1, h - 1);
    249  }
    250  
    251 -int
    252 -drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
    253 -{
    254 -	char buf[1024];
    255 -	int ty;
    256 -	unsigned int ew;
    257 -	XftDraw *d = NULL;
    258 -	Fnt *usedfont, *curfont, *nextfont;
    259 -	size_t i, len;
    260 -	int utf8strlen, utf8charlen, render = x || y || w || h;
    261 -	long utf8codepoint = 0;
    262 -	const char *utf8str;
    263 -	FcCharSet *fccharset;
    264 -	FcPattern *fcpattern;
    265 -	FcPattern *match;
    266 -	XftResult result;
    267 -	int charexists = 0;
    268 -
    269 -	if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
    270 -		return 0;
    271 -
    272 -	if (!render) {
    273 -		w = ~w;
    274 -	} else {
    275 -		XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
    276 -		XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
    277 -		d = XftDrawCreate(drw->dpy, drw->drawable,
    278 -		                  DefaultVisual(drw->dpy, drw->screen),
    279 -		                  DefaultColormap(drw->dpy, drw->screen));
    280 -		x += lpad;
    281 -		w -= lpad;
    282 -	}
    283 -
    284 -	usedfont = drw->fonts;
    285 -	while (1) {
    286 -		utf8strlen = 0;
    287 -		utf8str = text;
    288 -		nextfont = NULL;
    289 -		while (*text) {
    290 -			utf8charlen = utf8decode(text, &utf8codepoint, UTF_SIZ);
    291 -			for (curfont = drw->fonts; curfont; curfont = curfont->next) {
    292 -				charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
    293 -				if (charexists) {
    294 -					if (curfont == usedfont) {
    295 -						utf8strlen += utf8charlen;
    296 -						text += utf8charlen;
    297 -					} else {
    298 -						nextfont = curfont;
    299 -					}
    300 -					break;
    301 -				}
    302 -			}
    303 -
    304 -			if (!charexists || nextfont)
    305 -				break;
    306 -			else
    307 -				charexists = 0;
    308 -		}
    309 -
    310 -		if (utf8strlen) {
    311 -			drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
    312 -			/* shorten text if necessary */
    313 -			for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
    314 -				drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
    315 -
    316 -			if (len) {
    317 -				memcpy(buf, utf8str, len);
    318 -				buf[len] = '\0';
    319 -				if (len < utf8strlen)
    320 -					for (i = len; i && i > len - 3; buf[--i] = '.')
    321 -						; /* NOP */
    322 -
    323 -				if (render) {
    324 -					ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
    325 -					XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
    326 -					                  usedfont->xfont, x, ty, (XftChar8 *)buf, len);
    327 -				}
    328 -				x += ew;
    329 -				w -= ew;
    330 -			}
    331 -		}
    332 -
    333 -		if (!*text) {
    334 -			break;
    335 -		} else if (nextfont) {
    336 -			charexists = 0;
    337 -			usedfont = nextfont;
    338 -		} else {
    339 -			/* Regardless of whether or not a fallback font is found, the
    340 -			 * character must be drawn. */
    341 -			charexists = 1;
    342 -
    343 -			fccharset = FcCharSetCreate();
    344 -			FcCharSetAddChar(fccharset, utf8codepoint);
    345 -
    346 -			if (!drw->fonts->pattern) {
    347 -				/* Refer to the comment in xfont_create for more information. */
    348 -				die("the first font in the cache must be loaded from a font string.");
    349 -			}
    350 -
    351 -			fcpattern = FcPatternDuplicate(drw->fonts->pattern);
    352 -			FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
    353 -			FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
    354 -			FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
    355 -
    356 -			FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
    357 -			FcDefaultSubstitute(fcpattern);
    358 -			match = XftFontMatch(drw->dpy, drw->screen, fcpattern, &result);
    359 -
    360 -			FcCharSetDestroy(fccharset);
    361 -			FcPatternDestroy(fcpattern);
    362 -
    363 -			if (match) {
    364 -				usedfont = xfont_create(drw, NULL, match);
    365 -				if (usedfont && XftCharExists(drw->dpy, usedfont->xfont, utf8codepoint)) {
    366 -					for (curfont = drw->fonts; curfont->next; curfont = curfont->next)
    367 -						; /* NOP */
    368 -					curfont->next = usedfont;
    369 -				} else {
    370 -					xfont_free(usedfont);
    371 -					usedfont = drw->fonts;
    372 -				}
    373 -			}
    374 -		}
    375 -	}
    376 -	if (d)
    377 -		XftDrawDestroy(d);
    378 -
    379 -	return x + (render ? w : 0);
    380 -}
    381 -
    382  void
    383  drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
    384  {
    385 @@ -388,29 +107,6 @@ drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
    386  	XSync(drw->dpy, False);
    387  }
    388  
    389 -unsigned int
    390 -drw_fontset_getwidth(Drw *drw, const char *text)
    391 -{
    392 -	if (!drw || !drw->fonts || !text)
    393 -		return 0;
    394 -	return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
    395 -}
    396 -
    397 -void
    398 -drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
    399 -{
    400 -	XGlyphInfo ext;
    401 -
    402 -	if (!font || !text)
    403 -		return;
    404 -
    405 -	XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
    406 -	if (w)
    407 -		*w = ext.xOff;
    408 -	if (h)
    409 -		*h = font->h;
    410 -}
    411 -
    412  Cur *
    413  drw_cur_create(Drw *drw, int shape)
    414  {
    415 diff --git a/drw.h b/drw.h
    416 index 4bcd5ad..0f73b59 100644
    417 --- a/drw.h
    418 +++ b/drw.h
    419 @@ -31,12 +31,6 @@ Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned i
    420  void drw_resize(Drw *drw, unsigned int w, unsigned int h);
    421  void drw_free(Drw *drw);
    422  
    423 -/* Fnt abstraction */
    424 -Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
    425 -void drw_fontset_free(Fnt* set);
    426 -unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
    427 -void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
    428 -
    429  /* Colorscheme abstraction */
    430  void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
    431  Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
    432 @@ -46,12 +40,10 @@ Cur *drw_cur_create(Drw *drw, int shape);
    433  void drw_cur_free(Drw *drw, Cur *cursor);
    434  
    435  /* Drawing context manipulation */
    436 -void drw_setfontset(Drw *drw, Fnt *set);
    437  void drw_setscheme(Drw *drw, Clr *scm);
    438  
    439  /* Drawing functions */
    440  void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
    441 -int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
    442  
    443  /* Map functions */
    444  void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
    445 diff --git a/dwm.c b/dwm.c
    446 index 4465af1..2e41a5b 100644
    447 --- a/dwm.c
    448 +++ b/dwm.c
    449 @@ -55,7 +55,6 @@
    450  #define WIDTH(X)                ((X)->w + 2 * (X)->bw)
    451  #define HEIGHT(X)               ((X)->h + 2 * (X)->bw)
    452  #define TAGMASK                 ((1 << LENGTH(tags)) - 1)
    453 -#define TEXTW(X)                (drw_fontset_getwidth(drw, (X)) + lrpad)
    454  
    455  /* enums */
    456  enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
    457 @@ -64,8 +63,7 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
    458         NetWMFullscreen, NetActiveWindow, NetWMWindowType,
    459         NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
    460  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
    461 -enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
    462 -       ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
    463 +enum { ClkClientWin, ClkRootWin }; /* clicks */
    464  
    465  typedef union {
    466  	int i;
    467 @@ -116,19 +114,15 @@ struct Monitor {
    468  	float mfact;
    469  	int nmaster;
    470  	int num;
    471 -	int by;               /* bar geometry */
    472  	int mx, my, mw, mh;   /* screen size */
    473  	int wx, wy, ww, wh;   /* window area  */
    474  	unsigned int seltags;
    475  	unsigned int sellt;
    476  	unsigned int tagset[2];
    477 -	int showbar;
    478 -	int topbar;
    479  	Client *clients;
    480  	Client *sel;
    481  	Client *stack;
    482  	Monitor *next;
    483 -	Window barwin;
    484  	const Layout *lt[2];
    485  };
    486  
    487 @@ -161,10 +155,7 @@ static void destroynotify(XEvent *e);
    488  static void detach(Client *c);
    489  static void detachstack(Client *c);
    490  static Monitor *dirtomon(int dir);
    491 -static void drawbar(Monitor *m);
    492 -static void drawbars(void);
    493  static void enternotify(XEvent *e);
    494 -static void expose(XEvent *e);
    495  static void focus(Client *c);
    496  static void focusin(XEvent *e);
    497  static void focusmon(const Arg *arg);
    498 @@ -209,20 +200,16 @@ static void spawn(const Arg *arg);
    499  static void tag(const Arg *arg);
    500  static void tagmon(const Arg *arg);
    501  static void tile(Monitor *);
    502 -static void togglebar(const Arg *arg);
    503  static void togglefloating(const Arg *arg);
    504  static void toggletag(const Arg *arg);
    505  static void toggleview(const Arg *arg);
    506  static void unfocus(Client *c, int setfocus);
    507  static void unmanage(Client *c, int destroyed);
    508  static void unmapnotify(XEvent *e);
    509 -static void updatebarpos(Monitor *m);
    510 -static void updatebars(void);
    511  static void updateclientlist(void);
    512  static int updategeom(void);
    513  static void updatenumlockmask(void);
    514  static void updatesizehints(Client *c);
    515 -static void updatestatus(void);
    516  static void updatetitle(Client *c);
    517  static void updatewindowtype(Client *c);
    518  static void updatewmhints(Client *c);
    519 @@ -236,11 +223,8 @@ static void zoom(const Arg *arg);
    520  
    521  /* variables */
    522  static const char broken[] = "broken";
    523 -static char stext[256];
    524  static int screen;
    525  static int sw, sh;           /* X display screen geometry width, height */
    526 -static int bh, blw = 0;      /* bar geometry */
    527 -static int lrpad;            /* sum of left and right padding for text */
    528  static int (*xerrorxlib)(Display *, XErrorEvent *);
    529  static unsigned int numlockmask = 0;
    530  static void (*handler[LASTEvent]) (XEvent *) = {
    531 @@ -250,7 +234,6 @@ static void (*handler[LASTEvent]) (XEvent *) = {
    532  	[ConfigureNotify] = configurenotify,
    533  	[DestroyNotify] = destroynotify,
    534  	[EnterNotify] = enternotify,
    535 -	[Expose] = expose,
    536  	[FocusIn] = focusin,
    537  	[KeyPress] = keypress,
    538  	[MappingNotify] = mappingnotify,
    539 @@ -339,10 +322,6 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
    540  		if (*y + *h + 2 * c->bw <= m->wy)
    541  			*y = m->wy;
    542  	}
    543 -	if (*h < bh)
    544 -		*h = bh;
    545 -	if (*w < bh)
    546 -		*w = bh;
    547  	if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
    548  		/* see last two sentences in ICCCM 4.1.2.3 */
    549  		baseismin = c->basew == c->minw && c->baseh == c->minh;
    550 @@ -416,8 +395,7 @@ attachstack(Client *c)
    551  void
    552  buttonpress(XEvent *e)
    553  {
    554 -	unsigned int i, x, click;
    555 -	Arg arg = {0};
    556 +	unsigned int i, click;
    557  	Client *c;
    558  	Monitor *m;
    559  	XButtonPressedEvent *ev = &e->xbutton;
    560 @@ -429,21 +407,7 @@ buttonpress(XEvent *e)
    561  		selmon = m;
    562  		focus(NULL);
    563  	}
    564 -	if (ev->window == selmon->barwin) {
    565 -		i = x = 0;
    566 -		do
    567 -			x += TEXTW(tags[i]);
    568 -		while (ev->x >= x && ++i < LENGTH(tags));
    569 -		if (i < LENGTH(tags)) {
    570 -			click = ClkTagBar;
    571 -			arg.ui = 1 << i;
    572 -		} else if (ev->x < x + blw)
    573 -			click = ClkLtSymbol;
    574 -		else if (ev->x > selmon->ww - TEXTW(stext))
    575 -			click = ClkStatusText;
    576 -		else
    577 -			click = ClkWinTitle;
    578 -	} else if ((c = wintoclient(ev->window))) {
    579 +	if ((c = wintoclient(ev->window))) {
    580  		focus(c);
    581  		restack(selmon);
    582  		XAllowEvents(dpy, ReplayPointer, CurrentTime);
    583 @@ -452,7 +416,7 @@ buttonpress(XEvent *e)
    584  	for (i = 0; i < LENGTH(buttons); i++)
    585  		if (click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button
    586  		&& CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state))
    587 -			buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg);
    588 +			buttons[i].func(&buttons[i].arg);
    589  }
    590  
    591  void
    592 @@ -504,8 +468,6 @@ cleanupmon(Monitor *mon)
    593  		for (m = mons; m && m->next != mon; m = m->next);
    594  		m->next = mon->next;
    595  	}
    596 -	XUnmapWindow(dpy, mon->barwin);
    597 -	XDestroyWindow(dpy, mon->barwin);
    598  	free(mon);
    599  }
    600  
    601 @@ -561,13 +523,11 @@ configurenotify(XEvent *e)
    602  		sw = ev->width;
    603  		sh = ev->height;
    604  		if (updategeom() || dirty) {
    605 -			drw_resize(drw, sw, bh);
    606 -			updatebars();
    607 +			drw_resize(drw, sw, sh);
    608  			for (m = mons; m; m = m->next) {
    609  				for (c = m->clients; c; c = c->next)
    610  					if (c->isfullscreen)
    611  						resizeclient(c, m->mx, m->my, m->mw, m->mh);
    612 -				XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
    613  			}
    614  			focus(NULL);
    615  			arrange(NULL);
    616 @@ -636,8 +596,6 @@ createmon(void)
    617  	m->tagset[0] = m->tagset[1] = 1;
    618  	m->mfact = mfact;
    619  	m->nmaster = nmaster;
    620 -	m->showbar = showbar;
    621 -	m->topbar = topbar;
    622  	m->lt[0] = &layouts[0];
    623  	m->lt[1] = &layouts[1 % LENGTH(layouts)];
    624  	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
    625 @@ -692,65 +650,6 @@ dirtomon(int dir)
    626  	return m;
    627  }
    628  
    629 -void
    630 -drawbar(Monitor *m)
    631 -{
    632 -	int x, w, sw = 0;
    633 -	int boxs = drw->fonts->h / 9;
    634 -	int boxw = drw->fonts->h / 6 + 2;
    635 -	unsigned int i, occ = 0, urg = 0;
    636 -	Client *c;
    637 -
    638 -	/* draw status first so it can be overdrawn by tags later */
    639 -	if (m == selmon) { /* status is only drawn on selected monitor */
    640 -		drw_setscheme(drw, scheme[SchemeNorm]);
    641 -		sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
    642 -		drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
    643 -	}
    644 -
    645 -	for (c = m->clients; c; c = c->next) {
    646 -		occ |= c->tags;
    647 -		if (c->isurgent)
    648 -			urg |= c->tags;
    649 -	}
    650 -	x = 0;
    651 -	for (i = 0; i < LENGTH(tags); i++) {
    652 -		w = TEXTW(tags[i]);
    653 -		drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
    654 -		drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
    655 -		if (occ & 1 << i)
    656 -			drw_rect(drw, x + boxs, boxs, boxw, boxw,
    657 -				m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
    658 -				urg & 1 << i);
    659 -		x += w;
    660 -	}
    661 -	w = blw = TEXTW(m->ltsymbol);
    662 -	drw_setscheme(drw, scheme[SchemeNorm]);
    663 -	x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
    664 -
    665 -	if ((w = m->ww - sw - x) > bh) {
    666 -		if (m->sel) {
    667 -			drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
    668 -			drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
    669 -			if (m->sel->isfloating)
    670 -				drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
    671 -		} else {
    672 -			drw_setscheme(drw, scheme[SchemeNorm]);
    673 -			drw_rect(drw, x, 0, w, bh, 1, 1);
    674 -		}
    675 -	}
    676 -	drw_map(drw, m->barwin, 0, 0, m->ww, bh);
    677 -}
    678 -
    679 -void
    680 -drawbars(void)
    681 -{
    682 -	Monitor *m;
    683 -
    684 -	for (m = mons; m; m = m->next)
    685 -		drawbar(m);
    686 -}
    687 -
    688  void
    689  enternotify(XEvent *e)
    690  {
    691 @@ -770,16 +669,6 @@ enternotify(XEvent *e)
    692  	focus(c);
    693  }
    694  
    695 -void
    696 -expose(XEvent *e)
    697 -{
    698 -	Monitor *m;
    699 -	XExposeEvent *ev = &e->xexpose;
    700 -
    701 -	if (ev->count == 0 && (m = wintomon(ev->window)))
    702 -		drawbar(m);
    703 -}
    704 -
    705  void
    706  focus(Client *c)
    707  {
    708 @@ -802,7 +691,6 @@ focus(Client *c)
    709  		XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
    710  	}
    711  	selmon->sel = c;
    712 -	drawbars();
    713  }
    714  
    715  /* there are some broken focus acquiring clients needing extra handling */
    716 @@ -1044,9 +932,6 @@ manage(Window w, XWindowAttributes *wa)
    717  	if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
    718  		c->y = c->mon->my + c->mon->mh - HEIGHT(c);
    719  	c->x = MAX(c->x, c->mon->mx);
    720 -	/* only fix client y-offset, if the client center might cover the bar */
    721 -	c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
    722 -		&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
    723  	c->bw = borderpx;
    724  
    725  	wc.border_width = c->bw;
    726 @@ -1103,14 +988,8 @@ maprequest(XEvent *e)
    727  void
    728  monocle(Monitor *m)
    729  {
    730 -	unsigned int n = 0;
    731  	Client *c;
    732  
    733 -	for (c = m->clients; c; c = c->next)
    734 -		if (ISVISIBLE(c))
    735 -			n++;
    736 -	if (n > 0) /* override layout symbol */
    737 -		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
    738  	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
    739  		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
    740  }
    741 @@ -1215,9 +1094,7 @@ propertynotify(XEvent *e)
    742  	Window trans;
    743  	XPropertyEvent *ev = &e->xproperty;
    744  
    745 -	if ((ev->window == root) && (ev->atom == XA_WM_NAME))
    746 -		updatestatus();
    747 -	else if (ev->state == PropertyDelete)
    748 +	if (ev->state == PropertyDelete)
    749  		return; /* ignore */
    750  	else if ((c = wintoclient(ev->window))) {
    751  		switch(ev->atom) {
    752 @@ -1232,13 +1109,10 @@ propertynotify(XEvent *e)
    753  			break;
    754  		case XA_WM_HINTS:
    755  			updatewmhints(c);
    756 -			drawbars();
    757  			break;
    758  		}
    759  		if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
    760  			updatetitle(c);
    761 -			if (c == c->mon->sel)
    762 -				drawbar(c->mon);
    763  		}
    764  		if (ev->atom == netatom[NetWMWindowType])
    765  			updatewindowtype(c);
    766 @@ -1351,14 +1225,12 @@ restack(Monitor *m)
    767  	XEvent ev;
    768  	XWindowChanges wc;
    769  
    770 -	drawbar(m);
    771  	if (!m->sel)
    772  		return;
    773  	if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
    774  		XRaiseWindow(dpy, m->sel->win);
    775  	if (m->lt[m->sellt]->arrange) {
    776  		wc.stack_mode = Below;
    777 -		wc.sibling = m->barwin;
    778  		for (c = m->stack; c; c = c->snext)
    779  			if (!c->isfloating && ISVISIBLE(c)) {
    780  				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
    781 @@ -1507,8 +1379,6 @@ setlayout(const Arg *arg)
    782  	strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
    783  	if (selmon->sel)
    784  		arrange(selmon);
    785 -	else
    786 -		drawbar(selmon);
    787  }
    788  
    789  /* arg > 1.0 will set mfact absolutely */
    790 @@ -1542,10 +1412,6 @@ setup(void)
    791  	sh = DisplayHeight(dpy, screen);
    792  	root = RootWindow(dpy, screen);
    793  	drw = drw_create(dpy, screen, root, sw, sh);
    794 -	if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
    795 -		die("no fonts could be loaded.");
    796 -	lrpad = drw->fonts->h;
    797 -	bh = drw->fonts->h + 2;
    798  	updategeom();
    799  	/* init atoms */
    800  	utf8string = XInternAtom(dpy, "UTF8_STRING", False);
    801 @@ -1570,9 +1436,6 @@ setup(void)
    802  	scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
    803  	for (i = 0; i < LENGTH(colors); i++)
    804  		scheme[i] = drw_scm_create(drw, colors[i], 3);
    805 -	/* init bars */
    806 -	updatebars();
    807 -	updatestatus();
    808  	/* supporting window for NetWMCheck */
    809  	wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
    810  	XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
    811 @@ -1696,15 +1559,6 @@ tile(Monitor *m)
    812  		}
    813  }
    814  
    815 -void
    816 -togglebar(const Arg *arg)
    817 -{
    818 -	selmon->showbar = !selmon->showbar;
    819 -	updatebarpos(selmon);
    820 -	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
    821 -	arrange(selmon);
    822 -}
    823 -
    824  void
    825  togglefloating(const Arg *arg)
    826  {
    827 @@ -1798,41 +1652,6 @@ unmapnotify(XEvent *e)
    828  	}
    829  }
    830  
    831 -void
    832 -updatebars(void)
    833 -{
    834 -	Monitor *m;
    835 -	XSetWindowAttributes wa = {
    836 -		.override_redirect = True,
    837 -		.background_pixmap = ParentRelative,
    838 -		.event_mask = ButtonPressMask|ExposureMask
    839 -	};
    840 -	XClassHint ch = {"dwm", "dwm"};
    841 -	for (m = mons; m; m = m->next) {
    842 -		if (m->barwin)
    843 -			continue;
    844 -		m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
    845 -				CopyFromParent, DefaultVisual(dpy, screen),
    846 -				CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
    847 -		XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
    848 -		XMapRaised(dpy, m->barwin);
    849 -		XSetClassHint(dpy, m->barwin, &ch);
    850 -	}
    851 -}
    852 -
    853 -void
    854 -updatebarpos(Monitor *m)
    855 -{
    856 -	m->wy = m->my;
    857 -	m->wh = m->mh;
    858 -	if (m->showbar) {
    859 -		m->wh -= bh;
    860 -		m->by = m->topbar ? m->wy : m->wy + m->wh;
    861 -		m->wy = m->topbar ? m->wy + bh : m->wy;
    862 -	} else
    863 -		m->by = -bh;
    864 -}
    865 -
    866  void
    867  updateclientlist()
    868  {
    869 @@ -1887,7 +1706,6 @@ updategeom(void)
    870  					m->my = m->wy = unique[i].y_org;
    871  					m->mw = m->ww = unique[i].width;
    872  					m->mh = m->wh = unique[i].height;
    873 -					updatebarpos(m);
    874  				}
    875  		} else { /* less monitors available nn < n */
    876  			for (i = nn; i < n; i++) {
    877 @@ -1915,7 +1733,6 @@ updategeom(void)
    878  			dirty = 1;
    879  			mons->mw = mons->ww = sw;
    880  			mons->mh = mons->wh = sh;
    881 -			updatebarpos(mons);
    882  		}
    883  	}
    884  	if (dirty) {
    885 @@ -1984,14 +1801,6 @@ updatesizehints(Client *c)
    886  	c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
    887  }
    888  
    889 -void
    890 -updatestatus(void)
    891 -{
    892 -	if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
    893 -		strcpy(stext, "dwm-"VERSION);
    894 -	drawbar(selmon);
    895 -}
    896 -
    897  void
    898  updatetitle(Client *c)
    899  {
    900 @@ -2062,13 +1871,9 @@ wintomon(Window w)
    901  {
    902  	int x, y;
    903  	Client *c;
    904 -	Monitor *m;
    905  
    906  	if (w == root && getrootptr(&x, &y))
    907  		return recttomon(x, y, 1, 1);
    908 -	for (m = mons; m; m = m->next)
    909 -		if (w == m->barwin)
    910 -			return m;
    911  	if ((c = wintoclient(w)))
    912  		return c->mon;
    913  	return selmon;
    914 -- 
    915 2.22.0
    916