sites

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

commit a14388cffa89b04540bab8dbee80a5dbc9347d53
parent 77b78861131b7749f36b11b214ccd1f2d3f9256a
Author: NRK <nrk@disroot.org>
Date:   Sun, 20 Nov 2022 02:29:56 +0600

[dmenu][mouse-support]: fix bug and update description

Looks like I unknowningly reinvented the "hover-bg" version of the
patch. I hadn't noticed it since it was at the bottom of the list where
outdated patches typically are.

Looking at the "hover-bg" variant revealed a bug in the new patch where
promptw wasn't being accounted for.

But in any case, doesn't seem like there's any reason to have two
separate versions. If there are some reason for the separation then feel
free to pull the motionevent() into a separate diff.

Diffstat:
Mtools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-5.2.diff | 18++++++++++--------
Mtools.suckless.org/dmenu/patches/mouse-support/index.md | 2+-
2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-5.2.diff b/tools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-5.2.diff @@ -1,8 +1,8 @@ diff --git a/dmenu.c b/dmenu.c -index 27b7a30..c9bc84f 100644 +index 27b7a30..5363aa1 100644 --- a/dmenu.c +++ b/dmenu.c -@@ -528,6 +528,151 @@ draw: +@@ -528,6 +528,153 @@ draw: drawmenu(); } @@ -122,7 +122,7 @@ index 27b7a30..c9bc84f 100644 +static void +motionevent(XButtonEvent *ev) +{ -+ struct item *it; ++ struct item *it, *psel = sel; + + if (ev->window != win) + return; @@ -132,29 +132,31 @@ index 27b7a30..c9bc84f 100644 + for (it = curr; it && it != next; it = it->right) { + if (ev->y >= y && ev->y < (y + bh)) { + sel = it; -+ drawmenu(); + break; + } + y += bh; + } + } else if (matches) { -+ int x = inputw + TEXTW("<"); ++ int x = inputw + promptw + TEXTW("<"); + for (it = curr; it && it != next; it = it->right) { + int w = textw_clamp(it->text, mw - x - TEXTW(">")); + if (ev->x >= x && ev->x < (x + w)) { + sel = it; -+ drawmenu(); + break; + } + x += w; + } + } ++ if (psel != sel) { ++ calcoffsets(); ++ drawmenu(); ++ } +} + static void paste(void) { -@@ -586,6 +731,12 @@ run(void) +@@ -586,6 +733,12 @@ run(void) break; cleanup(); exit(1); @@ -167,7 +169,7 @@ index 27b7a30..c9bc84f 100644 case Expose: if (ev.xexpose.count == 0) drw_map(drw, win, 0, 0, mw, mh); -@@ -683,7 +834,8 @@ setup(void) +@@ -683,7 +836,8 @@ setup(void) /* create menu window */ swa.override_redirect = True; swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; diff --git a/tools.suckless.org/dmenu/patches/mouse-support/index.md b/tools.suckless.org/dmenu/patches/mouse-support/index.md @@ -22,7 +22,7 @@ Mouse actions supported: * In horizontal mode: same as left-clicking on right arrow. * In vertical mode: show items below. * Motion: - * Will select stuff. + * Will select the hovered item. Download --------