Re: [hackers] Re: [dmenu][PATCH] make prompt padding symmetric

2017-12-07 Thread Hiltjo Posthuma
On Thu, Dec 07, 2017 at 10:51:17PM +0100, Alessandro Caputo wrote:
>Sorry, forgot to add some info.
>At least on my two computers and with the fonts I tested, there's a
>problem with the padding of dmenu's prompt.
>I have attached two screenshots with simply an 'O' as prompt, and these
>are the pixel counts on each side of the 'O':
>- original: 18 left, 11 right
>- patched: 18 left, 19 right
>Cheers,
>Alessandro
> 
>On Thu, Dec 7, 2017 at 10:46 PM, Alessandro Caputo
><[1]nonedisponib...@gmail.com> wrote:
> 
>  ---
>   dmenu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>  diff --git a/dmenu.c b/dmenu.c
>  index eae5685..4173c62 100644
>  --- a/dmenu.c
>  +++ b/dmenu.c
>  @@ -604,7 +604,7 @@ setup(void)
>  y = topbar ? 0 : wa.height - mh;
>  mw = wa.width;
>  }
>  -   promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 :
>  0;
>  +   promptw = (prompt && *prompt) ? TEXTW(prompt) : 0;
>  inputw = MIN(inputw, mw/3);
>  match();
>  --
>  2.15.1
> 
> References
> 
>1. mailto:nonedisponib...@gmail.com

Hi,

What is your config.h and the font and fallback fonts you use?
I can also reproduce this.
-- 
Kind regards,
Hiltjo



Re: [hackers] Re: [dmenu][PATCH] make prompt padding symmetric

2017-12-07 Thread Markus Teich
Alessandro Caputo wrote:
> At least on my two computers and with the fonts I tested, there's a problem
> with the padding of dmenu's prompt.
> I have attached two screenshots with simply an 'O' as prompt, and these are
> the pixel counts on each side of the 'O':
> - original: 18 left, 11 right
> - patched: 18 left, 19 right

Heyho Alessandro,

Indeed I can confirm this behavior. I guess the reason for the unsymmetrical
padding is the expectation of prompts ending with ':'. If you try this out, you
will see a balanced prompt. I don't have strong feelings about what the default
should be and would not even mind an additional condition for checking the last
character of the prompt: (prompt[strlen[prompt]-1] == ':' ? lrpad / 4 : 0)

I'll defer to community opinion on what the default should be.

--Markus



[hackers] Re: [dmenu][PATCH] make prompt padding symmetric

2017-12-07 Thread Alessandro Caputo
Sorry, forgot to add some info.

At least on my two computers and with the fonts I tested, there's a problem
with the padding of dmenu's prompt.
I have attached two screenshots with simply an 'O' as prompt, and these are
the pixel counts on each side of the 'O':
- original: 18 left, 11 right
- patched: 18 left, 19 right

Cheers,
Alessandro


On Thu, Dec 7, 2017 at 10:46 PM, Alessandro Caputo <
nonedisponib...@gmail.com> wrote:

> ---
>  dmenu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dmenu.c b/dmenu.c
> index eae5685..4173c62 100644
> --- a/dmenu.c
> +++ b/dmenu.c
> @@ -604,7 +604,7 @@ setup(void)
> y = topbar ? 0 : wa.height - mh;
> mw = wa.width;
> }
> -   promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
> +   promptw = (prompt && *prompt) ? TEXTW(prompt) : 0;
> inputw = MIN(inputw, mw/3);
> match();
>
> --
> 2.15.1
>
>


[hackers] [dmenu][PATCH] make prompt padding symmetric

2017-12-07 Thread Alessandro Caputo
---
 dmenu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dmenu.c b/dmenu.c
index eae5685..4173c62 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -604,7 +604,7 @@ setup(void)
y = topbar ? 0 : wa.height - mh;
mw = wa.width;
}
-   promptw = (prompt && *prompt) ? TEXTW(prompt) - lrpad / 4 : 0;
+   promptw = (prompt && *prompt) ? TEXTW(prompt) : 0;
inputw = MIN(inputw, mw/3);
match();
 
-- 
2.15.1




[hackers] [blind] Makefile: Use .bo instead of .mcb.o, and $(HDR) instead of *.h || Mattias Andrée

2017-12-07 Thread git
commit c8c786ee5a16fec99414d6064a2f16a2745d18dd
Author: Mattias Andrée 
AuthorDate: Tue Dec 5 23:10:53 2017 +0100
Commit: Mattias Andrée 
CommitDate: Tue Dec 5 23:12:51 2017 +0100

Makefile: Use .bo instead of .mcb.o, and $(HDR) instead of *.h

Signed-off-by: Mattias Andrée 

diff --git a/.gitignore b/.gitignore
index c9f0f51..0dbd5d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@
 *.swo
 *.swp
 *.o
+*.bo
 *.out
 /platform.h
 /generate-macros
diff --git a/Makefile b/Makefile
index 3eb6163..92e2977 100644
--- a/Makefile
+++ b/Makefile
@@ -120,23 +120,23 @@ COMMON_OBJ =\
stream.o
 
 HDR =\
-   arg.h\
-   common.h\
-   define-functions.h\
-   stream.h\
-   util.h\
-   util/to.h\
-   util/jobs.h\
-   util/emalloc.h\
-   util/eopen.h\
-   util/endian.h\
-   util/colour.h\
-   util/io.h\
-   util/efflush.h\
-   util/efunc.h\
-   util/eprintf.h\
-   util/fshut.h\
-   video-math.h
+   src/arg.h\
+   src/common.h\
+   src/define-functions.h\
+   src/stream.h\
+   src/util.h\
+   src/util/to.h\
+   src/util/jobs.h\
+   src/util/emalloc.h\
+   src/util/eopen.h\
+   src/util/endian.h\
+   src/util/colour.h\
+   src/util/io.h\
+   src/util/efflush.h\
+   src/util/efunc.h\
+   src/util/eprintf.h\
+   src/util/fshut.h\
+   src/video-math.h
 
 MISCFILES =\
Makefile\
@@ -168,10 +168,10 @@ mcb: blind-mcb
 %: %.o $(COMMON_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
 
-%.o: src/%.c src/*.h src/*/*.h platform.h
+%.o: src/%.c $(HDR) platform.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
-%.mcb.o: src/%.c src/*.h src/*/*.h platform.h
+%.bo: src/%.c $(HDR) platform.h
$(CC) $(CFLAGS) $(CPPFLAGS) -Dmain="$$(printf 'main_%s\n' $* | tr -- - 
_)" -c -o $@ $<
 
 blind-mcb.c: Makefile
@@ -188,7 +188,7 @@ blind-mcb.c: Makefile
printf 'return 1;\n' >> blind-mcb.c
printf '}\n' >> blind-mcb.c
 
-blind-mcb: blind-mcb.o $(BIN:=.mcb.o) $(COMMON_OBJ)
+blind-mcb: blind-mcb.o $(BIN:=.bo) $(COMMON_OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
 
 generate-macros: src/generate-macros.c
@@ -247,8 +247,10 @@ dist:
mkdir -p "blind-$(VERSION)/src/util" "blind-$(VERSION)/man"
cp $(MISCFILES) $(SCRIPTS) "blind-$(VERSION)"
cd man && cp $(MAN1) $(MAN7) "../blind-$(VERSION)/man"
-   set -e && cd src && for s in $(SRC) $(HDR); do \
+   set -e && cd src && for s in $(SRC); do \
cp "$$s" "../blind-$(VERSION)/src/$$s"; done
+   set -e && for s in $(HDR); do \
+   cp "$$s" "../blind-$(VERSION)/$$s"; done
set -e && for e in $(EXAMPLEDIRS); do \
mkdir -p "blind-$(VERSION)/examples/$$e"; done
set -e && cd examples && for e in $(EXAMPLEFILES); \
@@ -258,9 +260,9 @@ dist:
rm -rf "blind-$(VERSION)"
 
 clean:
-   -rm -f $(BIN) *.o blind-$(VERSION).tar.gz platform.h generate-macros
-   -rm -f blind-mcb.c blind-mcb.o blind-mcb
-   -rm -rf "blind-$(VERSION)"
+   -rm -f -- $(BIN) *.o blind-$(VERSION).tar.gz platform.h generate-macros
+   -rm -f -- blind-mcb.c blind-mcb *.bo
+   -rm -rf -- "blind-$(VERSION)"
 
 
 .PHONY: all mcb install install-mcb uninstall dist clean



[hackers] [blind] Fix makefile || Mattias Andrée

2017-12-07 Thread git
commit 7ee326b71e1846c3b79be5aea9d9bfd94ef5aa38
Author: Mattias Andrée 
AuthorDate: Tue Dec 5 23:19:23 2017 +0100
Commit: Mattias Andrée 
CommitDate: Tue Dec 5 23:19:23 2017 +0100

Fix makefile

Signed-off-by: Mattias Andrée 

diff --git a/Makefile b/Makefile
index 92e2977..c92f925 100644
--- a/Makefile
+++ b/Makefile
@@ -155,7 +155,7 @@ EXAMPLEFILES =\
reverse/Makefile\
split/Makefile
 
-COMMON_SRC = $(COMMON_SRC:.o=.c)
+COMMON_SRC = $(COMMON_OBJ:.o=.c)
 SRC = $(BIN:=.c) $(COMMON_SRC)
 SCRIPTS = $(SH_SCRIPTS) $(KSH_SCRIPTS) 
 MAN1 = $(BIN:=.1) $(SCRIPTS:=.1)



[hackers] [blind] Improve makefile || Mattias Andrée

2017-12-07 Thread git
commit 881f7b4aa699291ae22db304dc9e259cb8331b58
Author: Mattias Andrée 
AuthorDate: Thu Dec 7 17:16:12 2017 +0100
Commit: Mattias Andrée 
CommitDate: Thu Dec 7 17:52:43 2017 +0100

Improve makefile

Almost fully (to the greatest extent possible) portable.
Do not rebuild everything everytime a .c file is added.
However, there is some minor oddities to allow use of -j.

Signed-off-by: Mattias Andrée 

diff --git a/.gitignore b/.gitignore
index 0dbd5d6..1816350 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,14 @@
-\#*\#*
-.\#*
 *~
+*\#*
 *.bak
 *.orig
 *.swo
 *.swp
+*.a
 *.o
 *.bo
 *.out
-/platform.h
-/generate-macros
+/build/
 /blind-*
 !/blind-rotate-90
 !/blind-rotate-180
diff --git a/Makefile b/Makefile
index c92f925..8d611c5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,112 +1,9 @@
+.POSIX:
+
 CONFIGFILE = config.mk
+include files.mk
 include $(CONFIGFILE)
 
-
-BIN =\
-   blind-affine-colour\
-   blind-apply-kernel\
-   blind-apply-palette\
-   blind-arithm\
-   blind-cat-cols\
-   blind-cat-rows\
-   blind-chroma-key\
-   blind-colour-ciexyz\
-   blind-colour-matrix\
-   blind-colour-srgb\
-   blind-compress\
-   blind-concat\
-   blind-cone-gradient\
-   blind-convert\
-   blind-coordinate-field\
-   blind-crop\
-   blind-cross-product\
-   blind-cut\
-   blind-decompress\
-   blind-disperse\
-   blind-dissolve\
-   blind-dot-product\
-   blind-double-sine-wave\
-   blind-dual-key\
-   blind-extend\
-   blind-extract-alpha\
-   blind-find-rectangle\
-   blind-flip\
-   blind-flop\
-   blind-from-image\
-   blind-from-named\
-   blind-from-portable\
-   blind-from-text\
-   blind-from-video\
-   blind-gauss-blur\
-   blind-get-colours\
-   blind-hexagon-tessellation\
-   blind-interleave\
-   blind-invert-luma\
-   blind-invert-matrix\
-   blind-kernel\
-   blind-linear-gradient\
-   blind-make-kernel\
-   blind-matrix-orthoproject\
-   blind-matrix-reflect\
-   blind-matrix-rotate\
-   blind-matrix-scale\
-   blind-matrix-shear\
-   blind-matrix-translate\
-   blind-matrix-transpose\
-   blind-mean\
-   blind-mosaic\
-   blind-mosaic-corners\
-   blind-mosaic-edges\
-   blind-multiply-matrices\
-   blind-next-frame\
-   blind-norm\
-   blind-peek-head\
-   blind-premultiply\
-   blind-quaternion-product\
-   blind-radial-gradient\
-   blind-read-head\
-   blind-rectangle-tessellation\
-   blind-repeat\
-   blind-repeat-tessellation\
-   blind-reverse\
-   blind-rewrite-head\
-   blind-round-wave\
-   blind-sawtooth-wave\
-   blind-set-alpha\
-   blind-set-luma\
-   blind-set-saturation\
-   blind-single-colour\
-   blind-sinc-wave\
-   blind-sine-wave\
-   blind-skip-pattern\
-   blind-spatial-arithm\
-   blind-spatial-mean\
-   blind-spectrum\
-   blind-spiral-gradient\
-   blind-split\
-   blind-split-chans\
-   blind-split-cols\
-   blind-split-rows\
-   blind-square-gradient\
-   blind-stack\
-   blind-tee\
-   blind-temporal-arithm\
-   blind-temporal-mean\
-   blind-time-blur\
-   blind-to-image\
-   blind-to-named\
-   blind-to-portable\
-   blind-to-text\
-   blind-to-video\
-   blind-transition\
-   blind-translate\
-   blind-transpose\
-   blind-triangle-tessellation\
-   blind-triangular-wave\
-   blind-unpremultiply\
-   blind-vector-projection\
-   blind-write-head
-
 SH_SCRIPTS =\
blind-rotate-90\
blind-rotate-180\
@@ -120,150 +17,82 @@ COMMON_OBJ =\
stream.o
 
 HDR =\
-   src/arg.h\
-   src/common.h\
-   src/define-functions.h\
-   src/stream.h\
-   src/util.h\
-   src/util/to.h\
-   src/util/jobs.h\
-   src/util/emalloc.h\
-   src/util/eopen.h\
-   src/util/endian.h\
-   src/util/colour.h\
-   src/util/io.h\
-   src/util/efflush.h\
-   src/util/efunc.h\
-   src/util/eprintf.h\
-   src/util/fshut.h\
-   src/video-math.h
+   arg.h\
+   common.h\
+   define-functions.h\
+   stream.h\
+   util.h\
+   util/to.h\
+   util/jobs.h\
+   util/emalloc.h\
+   util/eopen.h\
+   util/endian.h\
+   util/colour.h\
+   util/io.h\
+   util/efflush.h\
+   util/efunc.h\
+   util/eprintf.h\
+   util/fshut.h\
+   video-math.h
 
 MISCFILES =\
Makefile\
config.mk\
+   blind.mk\
+   rules.mk\
LICENSE\
README\
-   TODO
-
-EXAMPLEDIRS =\
-   inplace-flop\
-   reverse\
-   split
+   TODO\
+   src/generate-macros.c
 
 EXAMPLEFILES =\
inplace-flop/Makefile\
reverse/Makefile\

[hackers] [blind] blind-peek-head: fix minor compile-time bug || Mattias Andrée

2017-12-07 Thread git
commit 7fd0d921407ab77e67947a3e8ecd96686db25a6e
Author: Mattias Andrée 
AuthorDate: Thu Dec 7 17:55:46 2017 +0100
Commit: Mattias Andrée 
CommitDate: Thu Dec 7 17:55:51 2017 +0100

blind-peek-head: fix minor compile-time bug

Signed-off-by: Mattias Andrée 

diff --git a/src/blind-peek-head.c b/src/blind-peek-head.c
index 86c96b8..d33776b 100644
--- a/src/blind-peek-head.c
+++ b/src/blind-peek-head.c
@@ -115,7 +115,7 @@ main(int argc, char *argv[])
usleep(5);
beginning:
last_len = len;
-   len = peek(buf, n);
+   len = peek(buf, sizeof(buf));
p = memchr(buf, '\n', len);
if (p && len >= (size_t)(++p - buf) + ELEMENTSOF(magic))
goto ready;