Return to repo list

suckless-gf-dmenu

Gentoo-friendly patches for Suckless's dmenu.
Return to HMagellan.com

lineheight-nodoc.patch (1418B)


      1 diff --git a/dmenu.c b/dmenu.c
      2 index 6b8f51b..45d1946 100644
      3 --- a/dmenu.c
      4 +++ b/dmenu.c
      5 @@ -131,7 +131,7 @@ drawmenu(void)
      6  {
      7  	unsigned int curpos;
      8  	struct item *item;
      9 -	int x = 0, y = 0, w;
     10 +	int x = 0, y = 0, fh = drw->fonts->h, w;
     11  
     12  	drw_setscheme(drw, scheme[SchemeNorm]);
     13  	drw_rect(drw, 0, 0, mw, mh, 1, 1);
     14 @@ -148,7 +148,7 @@ drawmenu(void)
     15  	curpos = TEXTW(text) - TEXTW(&text[cursor]);
     16  	if ((curpos += lrpad / 2 - 1) < w) {
     17  		drw_setscheme(drw, scheme[SchemeNorm]);
     18 -		drw_rect(drw, x + curpos, 2, 2, bh - 4, 1, 0);
     19 +		drw_rect(drw, x + curpos, 2 + (bh-fh)/2, 2, fh - 4, 1, 0);
     20  	}
     21  
     22  	if (lines > 0) {
     23 @@ -604,6 +604,7 @@ setup(void)
     24  
     25  	/* calculate menu geometry */
     26  	bh = drw->fonts->h + 2;
     27 +	bh = MAX(bh,lineheight);	/* make a menu line AT LEAST 'lineheight' tall */
     28  	lines = MAX(lines, 0);
     29  	mh = (lines + 1) * bh;
     30  #ifdef XINERAMA
     31 @@ -716,6 +718,10 @@ main(int argc, char *argv[])
     32  			prompt = argv[++i];
     33  		else if (!strcmp(argv[i], "-fn"))  /* font or font set */
     34  			fonts[0] = argv[++i];
     35 +		else if(!strcmp(argv[i], "-h")) { /* minimum height of one menu line */
     36 +			lineheight = atoi(argv[++i]);
     37 +			lineheight = MAX(lineheight,8); /* reasonable default in case of value too small/negative */
     38 +		}
     39  		else if (!strcmp(argv[i], "-nb"))  /* normal background color */
     40  			colors[SchemeNorm][ColBg] = argv[++i];
     41  		else if (!strcmp(argv[i], "-nf"))  /* normal foreground color */
     42 -- 
     43 2.21.0
     44