sites

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

commit 6b6a3370e0e2488e5dc5f862fceba9f9cff68b74
parent 5d07ac34e426d9bb9d36bd0d1d19e4f2d42085da
Author: NRK <nrk@disroot.org>
Date:   Sun, 20 Nov 2022 16:50:27 +0600

[dmenu][mouse-support]: add separate motion patch

also add a separate section for the motion patches so they are more
easily visible.

Diffstat:
Atools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-motion-5.2.diff | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools.suckless.org/dmenu/patches/mouse-support/index.md | 8++++++++
2 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-motion-5.2.diff b/tools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-motion-5.2.diff @@ -0,0 +1,64 @@ +diff --git a/dmenu.c b/dmenu.c +index 48d4980..5363aa1 100644 +--- a/dmenu.c ++++ b/dmenu.c +@@ -641,6 +641,40 @@ buttonpress(XEvent *e) + } + } + ++static void ++motionevent(XButtonEvent *ev) ++{ ++ struct item *it, *psel = sel; ++ ++ if (ev->window != win) ++ return; ++ ++ if (lines > 0) { /* vertical list */ ++ int y = bh; ++ for (it = curr; it && it != next; it = it->right) { ++ if (ev->y >= y && ev->y < (y + bh)) { ++ sel = it; ++ break; ++ } ++ y += bh; ++ } ++ } else if (matches) { ++ 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; ++ break; ++ } ++ x += w; ++ } ++ } ++ if (psel != sel) { ++ calcoffsets(); ++ drawmenu(); ++ } ++} ++ + static void + paste(void) + { +@@ -702,6 +736,9 @@ run(void) + case ButtonPress: + buttonpress(&ev); + break; ++ case MotionNotify: ++ motionevent(&ev.xbutton); ++ break; + case Expose: + if (ev.xexpose.count == 0) + drw_map(drw, win, 0, 0, mw, mh); +@@ -800,7 +837,7 @@ setup(void) + swa.override_redirect = True; + swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; + swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | +- ButtonPressMask; ++ ButtonPressMask | PointerMotionMask; + win = XCreateWindow(dpy, parentwin, x, y, mw, mh, 0, + CopyFromParent, CopyFromParent, CopyFromParent, + CWOverrideRedirect | CWBackPixel | CWEventMask, &swa); diff --git a/tools.suckless.org/dmenu/patches/mouse-support/index.md b/tools.suckless.org/dmenu/patches/mouse-support/index.md @@ -21,6 +21,8 @@ Mouse actions supported: * Scroll down: * In horizontal mode: same as left-clicking on right arrow. * In vertical mode: show items below. +* Motion (needs motion-support patch): + * Selects the hovered item. Download -------- @@ -31,6 +33,11 @@ Download * [dmenu-mousesupport-4.7.diff](dmenu-mousesupport-4.7.diff) * [dmenu-mousesupport-4.6.diff](dmenu-mousesupport-4.6.diff) * [dmenu-mousesupport-20160702-3c91eed.diff](dmenu-mousesupport-20160702-3c91eed.diff) + +Motion Support +-------------- +* [dmenu-mousesupport-motion-5.2.diff](dmenu-mousesupport-motion-5.2.diff) + (Applies on top of the original mouse-support patch). * [dmenu-mousesupporthoverbgcol-20210123-1a13d04.diff](dmenu-mousesupporthoverbgcol-20210123-1a13d04.diff) set selectbg color on hovered item. * [dmenu-mousesupporthoverbgcol-5.0.diff](dmenu-mousesupporthoverbgcol-5.0.diff) @@ -44,3 +51,4 @@ Author * Xarchus (for multisel support). * prx (for selectbg color on hovered item) * Nathan Sketch (for grid compatibility) - <sketchn98@gmail.com> +* NRK <nrk@disroot.org> - Motion support for v5.2