sbstnc / dmenu-ee

dmenu-ee // dynamic menu extended edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scroll only 3 lines per wheel?

luebking opened this issue · comments

One could add a switch to control this, interpreting "0" (the default) as the present page scrolling behavior.
Opinions?

diff --git a/dmenu.c b/dmenu.c
index 6c66db8..36580aa 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -725,14 +725,18 @@ buttonpress(XEvent *e) {
        }
        /* scroll up */
        if(ev->button == Button4 && prev) {
-               sel = curr = prev;
+               int i = 0;
+               while(++i < 4 && sel && sel->left)
+                       curr = sel = sel->left;
                calcoffsets();
                drawmenu();
                return;
        }
        /* scroll down */
        if(ev->button == Button5 && next) {
-               sel = curr = next;
+               int i = 0;
+               while(++i < 4 && sel && sel->right)
+                       curr = sel = sel->right;
                calcoffsets();
                drawmenu();
                return;

Better variant (keeps highlight under the pointer):

diff --git a/dmenu.c b/dmenu.c
index 6c66db8..182eab3 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -725,14 +725,22 @@ buttonpress(XEvent *e) {
        }
        /* scroll up */
        if(ev->button == Button4 && prev) {
-               sel = curr = prev;
+               int i = 0;
+               while(++i < 4 && sel && sel->left && curr && curr->left) {
+                       curr = curr->left;
+                       sel = sel->left;
+               }
                calcoffsets();
                drawmenu();
                return;
        }
        /* scroll down */
        if(ev->button == Button5 && next) {
-               sel = curr = next;
+               int i = 0;
+               while(++i < 4 && sel && sel->right && curr && curr->right) {
+                       curr = curr->right;
+                       sel = sel->right;
+               }
                calcoffsets();
                drawmenu();
                return;

Hi, this worked nicely with dmenu-4.6, but with dmenu-4.7 it's not. There's hardly any differences between the mousesupport patch versions either.

Patch still applies and works (for me) on dmenu-ee git master - commit e411552 (which fell behind dmenu upstream?)

How do you patch http://tools.suckless.org/dmenu/ in total?

Yeah it's somewhat behind upstream..
I patch official 'mousesupport-4.7', then '3linesperwheel' and a adapted version of 'xyw' for dmenu-4.7. I was sure this would fly, but I must be overlooking something. Thanks!