aboutsummaryrefslogtreecommitdiff
path: root/patches/dmenu-mousesupport-motion-5.2.diff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-08 23:39:44 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-08 23:39:44 +0200
commitdae575e87aa42d94050ee05a290d124b20858d4e (patch)
treec19c2419f3f47cef661644b725f071f0576c50cb /patches/dmenu-mousesupport-motion-5.2.diff
parent327b6e0b41e5693a059353405fb3cb8a591a1cfc (diff)
downloaddmenu-dae575e87aa42d94050ee05a290d124b20858d4e.tar.gz
dmenu-dae575e87aa42d94050ee05a290d124b20858d4e.tar.bz2
dmenu-dae575e87aa42d94050ee05a290d124b20858d4e.zip
update
Diffstat (limited to 'patches/dmenu-mousesupport-motion-5.2.diff')
-rw-r--r--patches/dmenu-mousesupport-motion-5.2.diff53
1 files changed, 53 insertions, 0 deletions
diff --git a/patches/dmenu-mousesupport-motion-5.2.diff b/patches/dmenu-mousesupport-motion-5.2.diff
new file mode 100644
index 0000000..414201c
--- /dev/null
+++ b/patches/dmenu-mousesupport-motion-5.2.diff
@@ -0,0 +1,53 @@
+diff --git a/dmenu.c b/dmenu.c
+index 48d4980..7677401 100644
+--- a/dmenu.c
++++ b/dmenu.c
+@@ -641,6 +641,29 @@ buttonpress(XEvent *e)
+ }
+ }
+
++static void
++motionevent(XButtonEvent *ev)
++{
++ struct item *it;
++ int xy, ev_xy;
++
++ if (ev->window != win || matches == 0)
++ return;
++
++ xy = lines > 0 ? bh : inputw + promptw + TEXTW("<");
++ ev_xy = lines > 0 ? ev->y : ev->x;
++ for (it = curr; it && it != next; it = it->right) {
++ int wh = lines > 0 ? bh : textw_clamp(it->text, mw - xy - TEXTW(">"));
++ if (ev_xy >= xy && ev_xy < (xy + wh)) {
++ sel = it;
++ calcoffsets();
++ drawmenu();
++ break;
++ }
++ xy += wh;
++ }
++}
++
+ static void
+ paste(void)
+ {
+@@ -702,6 +725,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 +826,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);