sites

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

dmenu-border-20201112-1a13d04.diff (1646B)


      1 From d0c3fc8a634c153856cd41438f705175a21ec69a Mon Sep 17 00:00:00 2001
      2 From: braskin <benjaminiraskin@gmail.com>
      3 Date: Thu, 12 Nov 2020 10:13:29 -0500
      4 Subject: [PATCH] fixed border width draw for topbar
      5 
      6 ---
      7  config.def.h | 3 +++
      8  dmenu.c      | 6 +++++-
      9  2 files changed, 8 insertions(+), 1 deletion(-)
     10 
     11 diff --git a/config.def.h b/config.def.h
     12 index 1edb647..dd3eb31 100644
     13 --- a/config.def.h
     14 +++ b/config.def.h
     15 @@ -21,3 +21,6 @@ static unsigned int lines      = 0;
     16   * for example: " /?\"&[]"
     17   */
     18  static const char worddelimiters[] = " ";
     19 +
     20 +/* Size of the window border */
     21 +static unsigned int border_width = 0;
     22 diff --git a/dmenu.c b/dmenu.c
     23 index 65f25ce..716e655 100644
     24 --- a/dmenu.c
     25 +++ b/dmenu.c
     26 @@ -659,9 +659,11 @@ setup(void)
     27  	swa.override_redirect = True;
     28  	swa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
     29  	swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask;
     30 -	win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
     31 +	win = XCreateWindow(dpy, parentwin, x, y - (topbar ? 0 : border_width * 2), mw - border_width * 2, mh, border_width,
     32  	                    CopyFromParent, CopyFromParent, CopyFromParent,
     33  	                    CWOverrideRedirect | CWBackPixel | CWEventMask, &swa);
     34 +	if (border_width)
     35 +		XSetWindowBorder(dpy, win, scheme[SchemeSel][ColBg].pixel);
     36  	XSetClassHint(dpy, win, &ch);
     37  
     38  
     39 @@ -733,6 +735,8 @@ main(int argc, char *argv[])
     40  			colors[SchemeSel][ColFg] = argv[++i];
     41  		else if (!strcmp(argv[i], "-w"))   /* embedding window id */
     42  			embed = argv[++i];
     43 +		else if (!strcmp(argv[i], "-bw"))
     44 +			border_width = atoi(argv[++i]); /* border width */
     45  		else
     46  			usage();
     47  
     48 -- 
     49 2.25.1
     50