sites

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

commit b28ae177223c4eba99b844562e103915c01cdb22
parent 978a072cd425cadd334111b37f24242691c94a95
Author: NRK <nrk@disroot.org>
Date:   Sat, 19 Nov 2022 21:30:22 +0600

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

Diffstat:
Mtools.suckless.org/dmenu/patches/mouse-support/dmenu-mousesupport-5.2.diff | 45++++++++++++++++++++++++++++++++++++++++-----
Mtools.suckless.org/dmenu/patches/mouse-support/index.md | 3+++
2 files changed, 43 insertions(+), 5 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 7cf253b..d276a94 100644 +index 27b7a30..c9bc84f 100644 --- a/dmenu.c +++ b/dmenu.c -@@ -528,6 +528,119 @@ draw: +@@ -528,6 +528,151 @@ draw: drawmenu(); } @@ -119,26 +119,61 @@ index 7cf253b..d276a94 100644 + } +} + ++static void ++motionevent(XButtonEvent *ev) ++{ ++ struct item *it; ++ ++ 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; ++ drawmenu(); ++ break; ++ } ++ y += bh; ++ } ++ } else if (matches) { ++ int x = inputw + 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; ++ } ++ } ++} ++ static void paste(void) { -@@ -582,6 +695,9 @@ run(void) +@@ -586,6 +731,12 @@ run(void) break; cleanup(); exit(1); + 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); -@@ -679,7 +795,8 @@ setup(void) +@@ -683,7 +834,8 @@ setup(void) /* create menu window */ swa.override_redirect = True; swa.background_pixel = scheme[SchemeNorm][ColBg].pixel; - swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; + 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: + * Will select stuff. Download -------- @@ -44,3 +46,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