[wiki] [sites] [dmenu][patch][gridnav] removed bool and changed left/right navigation logic || Nathan Sketch
commit 365eb055580d8c47d3b6cd47880629cf747a7536
Author: Nathan Sketch <sketchn98_AT_gmail.com>
Date: Thu Aug 5 05:26:37 2021 -0400
[dmenu][patch][gridnav] removed bool and changed left/right navigation logic
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
old mode 100644
new mode 100755
index 9a555272..3e7246cc
--- a/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff
+++ b/tools.suckless.org/dmenu/patches/gridnav/dmenu-gridnav-5.0.diff
_AT_@ -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
-_AT_@ -7,6 +7,7 @@
- #include <strings.h>
- #include <time.h>
- #include <unistd.h>
-+#include <stdbool.h>
-
- #include <X11/Xlib.h>
- #include <X11/Xatom.h>
-_AT_@ -317,6 +318,9 @@ keypress(XKeyEvent *ev)
+_AT_@ -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) {
-_AT_@ -443,6 +447,24 @@ insert:
+_AT_@ -443,6 +445,27 @@ insert:
calcoffsets();
break;
case XK_Left:
_AT_@ -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;
_AT_@ -45,7 +39,7 @@ index 7361377..76acee6 100644
if (cursor > 0 && (!sel || !sel->left || lines > 0)) {
cursor = nextrune(-1);
break;
-_AT_@ -479,6 +501,24 @@ insert:
+_AT_@ -479,6 +502,27 @@ insert:
sel->out = 1;
break;
case XK_Right:
_AT_@ -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) {
Received on Thu Aug 05 2021 - 11:26:52 CEST
This archive was generated by hypermail 2.3.0
: Thu Aug 05 2021 - 11:36:43 CEST