mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
Adding barpadding patch
This commit is contained in:
parent
d3b51477fc
commit
333a738709
@ -28,7 +28,7 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/YjT2DD6j
|
||||
|
||||
### Changelog:
|
||||
|
||||
2022-06-21 - Adding relative input width patch
|
||||
2022-06-21 - Adding barpadding patch and relative input width patch
|
||||
|
||||
2022-03-02 - Bump to 5.1
|
||||
|
||||
@ -66,6 +66,10 @@ Browsing patches? There is a [map of patches](https://coggle.it/diagram/YjT2DD6j
|
||||
- [alpha](https://github.com/bakkeby/patches/blob/master/dmenu/dmenu-alpha-5.0_20210725_523aa08.diff)
|
||||
- adds transparency for the dmenu window
|
||||
|
||||
- [barpadding](https://github.com/bakkeby/patches/wiki/barpadding)
|
||||
- adds padding for dmenu in similar fashion to the [barpadding](https://dwm.suckless.org/patches/barpadding/)
|
||||
patch for dwm
|
||||
|
||||
- [border](http://tools.suckless.org/dmenu/patches/border/)
|
||||
- adds a border around the dmenu window
|
||||
|
||||
|
@ -18,6 +18,10 @@ static int instant = 0; /* -n option; if 1, selects matchin
|
||||
static int center = 1; /* -c option; if 0, dmenu won't be centered on the screen */
|
||||
static int min_width = 500; /* minimum width when centered */
|
||||
#endif // CENTER_PATCH
|
||||
#if BARPADDING_PATCH
|
||||
static const int vertpad = 10; /* vertical padding of bar */
|
||||
static const int sidepad = 10; /* horizontal padding of bar */
|
||||
#endif // BARPADDING_PATCH
|
||||
#if RESTRICT_RETURN_PATCH
|
||||
static int restrict_return = 0; /* -1 option; if 1, disables shift-return and ctrl-return */
|
||||
#endif // RESTRICT_RETURN_PATCH
|
||||
|
32
dmenu.c
32
dmenu.c
@ -126,6 +126,10 @@ static int inputw = 0, promptw;
|
||||
static int passwd = 0;
|
||||
#endif // PASSWORD_PATCH
|
||||
static int lrpad; /* sum of left and right padding */
|
||||
#if BARPADDING_PATCH
|
||||
static int vp; /* vertical padding for bar */
|
||||
static int sp; /* side padding for bar */
|
||||
#endif // BARPADDING_PATCH
|
||||
#if REJECTNOMATCH_PATCH
|
||||
static int reject_no_match = 0;
|
||||
#endif // REJECTNOMATCH_PATCH
|
||||
@ -596,6 +600,12 @@ drawmenu(void)
|
||||
#if NUMBERS_PATCH
|
||||
recalculatenumbers();
|
||||
rpad = TEXTW(numbers);
|
||||
#if BARPADDING_PATCH
|
||||
rpad += 2 * sp;
|
||||
#endif // BARPADDING_PATCH
|
||||
#if BORDER_PATCH
|
||||
rpad += border_width;
|
||||
#endif // BORDER_PATCH
|
||||
#endif // NUMBERS_PATCH
|
||||
if (lines > 0) {
|
||||
#if GRID_PATCH
|
||||
@ -681,8 +691,7 @@ drawmenu(void)
|
||||
}
|
||||
#if NUMBERS_PATCH
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_text(drw, mw - TEXTW(numbers), 0, TEXTW(numbers), bh, lrpad / 2, numbers, 0);
|
||||
#else
|
||||
drw_text(drw, mw - rpad, 0, TEXTW(numbers), bh, lrpad / 2, numbers, 0);
|
||||
#endif // NUMBERS_PATCH
|
||||
drw_map(drw, win, 0, 0, mw, mh);
|
||||
#if NON_BLOCKING_STDIN_PATCH
|
||||
@ -1683,11 +1692,17 @@ setup(void)
|
||||
| ButtonPressMask
|
||||
#endif // MOUSE_SUPPORT_PATCH
|
||||
;
|
||||
#if BORDER_PATCH
|
||||
win = XCreateWindow(dpy, parentwin, x, y - (topbar ? 0 : border_width * 2), mw - border_width * 2, mh, border_width,
|
||||
win = XCreateWindow(
|
||||
dpy, parentwin,
|
||||
#if BARPADDING_PATCH && BORDER_PATCH
|
||||
x + sp, y + vp - (topbar ? 0 : border_width * 2), mw - 2 * sp - border_width * 2, mh, border_width,
|
||||
#elif BARPADDING_PATCH
|
||||
x + sp, y + vp, mw - 2 * sp, mh, 0,
|
||||
#elif BORDER_PATCH
|
||||
x, y - (topbar ? 0 : border_width * 2), mw - border_width * 2, mh, border_width,
|
||||
#else
|
||||
win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0,
|
||||
#endif // BORDER_PATCH
|
||||
x, y, mw, mh, 0,
|
||||
#endif // BORDER_PATCH | BARPADDING_PATCH
|
||||
#if ALPHA_PATCH
|
||||
depth, InputOutput, visual,
|
||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa
|
||||
@ -2069,6 +2084,11 @@ main(int argc, char *argv[])
|
||||
lrpad = drw->fonts->h;
|
||||
#endif // PANGO_PATCH
|
||||
|
||||
#if BARPADDING_PATCH
|
||||
sp = sidepad;
|
||||
vp = (topbar ? vertpad : - vertpad);
|
||||
#endif // BARPADDING_PATCH
|
||||
|
||||
#if LINE_HEIGHT_PATCH
|
||||
if (lineheight == -1)
|
||||
#if PANGO_PATCH
|
||||
|
@ -7,6 +7,12 @@
|
||||
*/
|
||||
#define ALPHA_PATCH 0
|
||||
|
||||
/* This adds padding for dmenu in similar fashion to the similarly named patch for dwm. The idea
|
||||
* is to have dmenu appear on top of the bar when using said patch in dwm.
|
||||
* https://github.com/bakkeby/patches/wiki/barpadding
|
||||
*/
|
||||
#define BARPADDING_PATCH 0
|
||||
|
||||
/* This patch adds a border around the dmenu window. It is intended to be used with the center
|
||||
* or xyw patches, to make the menu stand out from similarly coloured windows.
|
||||
* http://tools.suckless.org/dmenu/patches/border/
|
||||
|
Loading…
Reference in New Issue
Block a user