sites

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

commit 365eb055580d8c47d3b6cd47880629cf747a7536
parent 138e9dfca1c9eba5554b4072066eda7013ec8144
Author: Nathan Sketch <sketchn98@gmail.com>
Date:   Thu,  5 Aug 2021 05:26:37 -0400

[dmenu][patch][gridnav] removed bool and changed left/right navigation logic

Diffstat:
Mtools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff | 33+++++++++++++++------------------
1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff b/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff @@ -1,26 +1,17 @@ diff --git a/dmenu.c b/dmenu.c -index 7361377..76acee6 100644 +index 7361377..fcec79b 100644 --- a/dmenu.c +++ b/dmenu.c -@@ -7,6 +7,7 @@ - #include <strings.h> - #include <time.h> - #include <unistd.h> -+#include <stdbool.h> - - #include <X11/Xlib.h> - #include <X11/Xatom.h> -@@ -317,6 +318,9 @@ keypress(XKeyEvent *ev) +@@ -317,6 +317,8 @@ keypress(XKeyEvent *ev) int len; KeySym ksym; Status status; -+ int i; ++ int i, offscreen = 0; + struct item *tmpsel; -+ bool offscreen = false; len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); switch (status) { -@@ -443,6 +447,24 @@ insert: +@@ -443,6 +445,27 @@ insert: calcoffsets(); break; case XK_Left: @@ -29,10 +20,13 @@ index 7361377..76acee6 100644 + return; + tmpsel = sel; + for (i = 0; i < lines; i++) { -+ if (!tmpsel->left || tmpsel->left->right != tmpsel) ++ if (!tmpsel->left || tmpsel->left->right != tmpsel) { ++ if (offscreen) ++ break; + return; ++ } + if (tmpsel == curr) -+ offscreen = true; ++ offscreen = 1; + tmpsel = tmpsel->left; + } + sel = tmpsel; @@ -45,7 +39,7 @@ index 7361377..76acee6 100644 if (cursor > 0 && (!sel || !sel->left || lines > 0)) { cursor = nextrune(-1); break; -@@ -479,6 +501,24 @@ insert: +@@ -479,6 +502,27 @@ insert: sel->out = 1; break; case XK_Right: @@ -54,11 +48,14 @@ index 7361377..76acee6 100644 + return; + tmpsel = sel; + for (i = 0; i < lines; i++) { -+ if (!tmpsel->right || tmpsel->right->left != tmpsel) ++ if (!tmpsel->right || tmpsel->right->left != tmpsel) { ++ if (offscreen) ++ break; + return; ++ } + tmpsel = tmpsel->right; + if (tmpsel == next) -+ offscreen = true; ++ offscreen = 1; + } + sel = tmpsel; + if (offscreen) {