summaryrefslogtreecommitdiff
path: root/dmenu.c
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2022-03-24 02:00:00 +0600
committerrafa_99 <raroma09@gmail.com>2022-03-25 23:13:02 +0000
commit35cd8b5f668e3362e76ad95c7edc39a88282335d (patch)
tree3194d4894202192adf707eb96a53356ae81a8524 /dmenu.c
parent3daa17ff1381f83ecdd143da817bc931423dfc80 (diff)
introduce drw_fontset_getwidth_clamp()
getting the width of a string is an O(n) operation, and in many cases users only care about getting the width upto a certain number. instead of calling drw_fontset_getwidth() and *then* clamping the result, this patch introduces drw_fontset_getwidth_clamp() function, similar to strnlen(), which will stop once we reach n. the `invert` parameter was overloaded internally to preserve the API, however library users should be calling drw_fontset_getwidth_clamp() and not depend upon internal behavior of drw_text().
Diffstat (limited to 'dmenu.c')
0 files changed, 0 insertions, 0 deletions