sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit bdf249cce6d84f1a108422afb8bba83603ccb5f3
parent 690aca7fd1e60aa9e58d4ba2ffc0d451dd272592
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Tue,  3 Aug 2010 18:08:59 +0100

updated dmenu description & cleaned tip patches
Diffstat:
Dtools.suckless.org/dmenu/dmenu-tip-cursor.diff | 159-------------------------------------------------------------------------------
Mtools.suckless.org/dmenu/index.md | 5+++--
Dtools.suckless.org/dmenu/patches/cursor.md | 11-----------
Dtools.suckless.org/dmenu/patches/dmenu-tip-cursor.diff | 142-------------------------------------------------------------------------------
Dtools.suckless.org/dmenu/patches/dmenu-tip-paste.diff | 27---------------------------
Mtools.suckless.org/dmenu/patches/paste.md | 3+--
Mtools.suckless.org/dmenu/patches/vertical.md | 2+-
7 files changed, 5 insertions(+), 344 deletions(-)

diff --git a/tools.suckless.org/dmenu/dmenu-tip-cursor.diff b/tools.suckless.org/dmenu/dmenu-tip-cursor.diff @@ -1,159 +0,0 @@ -diff -r 9b203c5c180d dmenu.c ---- a/dmenu.c Sat Apr 18 12:50:12 2009 +0100 -+++ b/dmenu.c Sun Nov 08 12:58:13 2009 +0100 -@@ -18,6 +18,7 @@ - #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) - #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) - #define MIN(a, b) ((a) < (b) ? (a) : (b)) -+#define MAX(a, b) ((a) > (b) ? (a) : (b)) - - /* enums */ - enum { ColFG, ColBG, ColLast }; -@@ -73,6 +74,7 @@ - static int cmdw = 0; - static int promptw = 0; - static int ret = 0; -+static int cursor = 0; - static int screen; - static unsigned int mw, mh; - static unsigned int numlockmask = 0; -@@ -171,6 +173,16 @@ - } - - void -+drawcursor(void) { -+ XRectangle r = { dc.x, dc.y + 2, 1, dc.h - 4 }; -+ -+ r.x += textnw(text, cursor) + dc.font.height / 2; -+ -+ XSetForeground(dpy, dc.gc, dc.norm[ColFG]); -+ XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); -+} -+ -+void - drawmenu(void) { - Item *i; - -@@ -190,6 +202,7 @@ - if(cmdw && item) - dc.w = cmdw; - drawtext(text[0] ? text : NULL, dc.norm); -+ drawcursor(); - dc.x += cmdw; - if(curr) { - dc.w = spaceitem; -@@ -331,8 +344,6 @@ - /* first check if a control mask is omitted */ - if(e->state & ControlMask) { - switch (ksym) { -- default: /* ignore other control sequences */ -- return; - case XK_bracketleft: - ksym = XK_Escape; - break; -@@ -353,7 +364,7 @@ - text[0] = 0; - match(text); - drawmenu(); -- return; -+ break; - case XK_w: - case XK_W: - if(len) { -@@ -365,12 +376,11 @@ - match(text); - drawmenu(); - } -- return; -+ break; - } - } - if(CLEANMASK(e->state) & Mod1Mask) { - switch(ksym) { -- default: return; - case XK_h: - ksym = XK_Left; - break; -@@ -393,15 +403,17 @@ - } - switch(ksym) { - default: -- if(num && !iscntrl((int) buf[0])) { -- buf[num] = 0; -- strncpy(text + len, buf, sizeof text - len); -+ if(num && !iscntrl((int) buf[0]) && num + strlen(text) < sizeof text) { -+ memmove(text + cursor + num, text + cursor, sizeof text - cursor); -+ memcpy(text + cursor, buf, num); -+ cursor+=num; - match(text); - } - break; - case XK_BackSpace: -- if(len) { -- text[--len] = 0; -+ if(cursor > 0) { -+ memmove(text + cursor + -1, text + cursor, sizeof text - cursor); -+ cursor--; - match(text); - } - break; -@@ -426,13 +438,17 @@ - calcoffsets(); - break; - case XK_Left: -- if(!(sel && sel->left)) -+ if(sel && sel->left){ -+ sel=sel->left; -+ if(sel->right == curr) { -+ curr = prev; -+ calcoffsets(); -+ } -+ } -+ else if(cursor > 0) -+ cursor--; -+ else - return; -- sel=sel->left; -- if(sel->right == curr) { -- curr = prev; -- calcoffsets(); -- } - break; - case XK_Next: - if(!next) -@@ -457,21 +473,29 @@ - running = False; - break; - case XK_Right: -- if(!(sel && sel->right)) -+ if(cursor < len) -+ cursor++; -+ else if(sel && sel->right) { -+ sel=sel->right; -+ if(sel == next) { -+ curr = next; -+ calcoffsets(); -+ } -+ } -+ else - return; -- sel=sel->right; -- if(sel == next) { -- curr = next; -- calcoffsets(); -- } - break; - case XK_Tab: - if(!sel) - return; - strncpy(text, sel->text, sizeof text); -+ cursor = strlen(text); - match(text); - break; - } -+ len = strlen(text); -+ cursor = MIN(cursor, len); -+ cursor = MAX(cursor, 0); - drawmenu(); - } - diff --git a/tools.suckless.org/dmenu/index.md b/tools.suckless.org/dmenu/index.md @@ -1,8 +1,9 @@ DMENU ===== -dynamic menu is a generic menu for X, originally designed for [dwm](http://dwm.suckless.org/). -It manages huge amounts (up to 10,000 and more) of user defined menu items efficiently. +dmenu is a dynamic menu for X, originally designed for +[dwm](http://dwm.suckless.org/). It manages large numbers of user-defined menu +items efficiently. Download diff --git a/tools.suckless.org/dmenu/patches/cursor.md b/tools.suckless.org/dmenu/patches/cursor.md @@ -1,11 +0,0 @@ -CURSOR HANDLING -=============== - -This patch implements extended text editing. - -Download --------- - -* [dmenu-tip-cursor.diff](dmenu-tip-cursor.diff) - -***Note, this patch is being accepted for mainstream dmenu and in hg tip.*** diff --git a/tools.suckless.org/dmenu/patches/dmenu-tip-cursor.diff b/tools.suckless.org/dmenu/patches/dmenu-tip-cursor.diff @@ -1,142 +0,0 @@ -diff -r 9b203c5c180d dmenu.c ---- a/dmenu.c Sat Apr 18 12:50:12 2009 +0100 -+++ b/dmenu.c Sun Nov 08 12:48:53 2009 +0100 -@@ -18,6 +18,7 @@ - #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) - #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) - #define MIN(a, b) ((a) < (b) ? (a) : (b)) -+#define MAX(a, b) ((a) > (b) ? (a) : (b)) - - /* enums */ - enum { ColFG, ColBG, ColLast }; -@@ -73,6 +74,7 @@ - static int cmdw = 0; - static int promptw = 0; - static int ret = 0; -+static int cursor = 0; - static int screen; - static unsigned int mw, mh; - static unsigned int numlockmask = 0; -@@ -171,6 +173,16 @@ - } - - void -+drawcursor(void) { -+ XRectangle r = { dc.x, dc.y + 2, 1, dc.h - 4 }; -+ -+ r.x += textnw(text, cursor) + dc.font.height / 2; -+ -+ XSetForeground(dpy, dc.gc, dc.norm[ColFG]); -+ XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1); -+} -+ -+void - drawmenu(void) { - Item *i; - -@@ -190,6 +202,7 @@ - if(cmdw && item) - dc.w = cmdw; - drawtext(text[0] ? text : NULL, dc.norm); -+ drawcursor(); - dc.x += cmdw; - if(curr) { - dc.w = spaceitem; -@@ -353,7 +366,7 @@ - text[0] = 0; - match(text); - drawmenu(); -- return; -+ break; - case XK_w: - case XK_W: - if(len) { -@@ -365,7 +378,7 @@ - match(text); - drawmenu(); - } -- return; -+ break; - } - } - if(CLEANMASK(e->state) & Mod1Mask) { -@@ -395,13 +408,16 @@ - default: - if(num && !iscntrl((int) buf[0])) { - buf[num] = 0; -- strncpy(text + len, buf, sizeof text - len); -+ memmove(text + cursor + num, text + cursor, sizeof text - cursor); -+ strncpy(text + cursor, buf, sizeof text - cursor); -+ cursor+=num; - match(text); - } - break; - case XK_BackSpace: -- if(len) { -- text[--len] = 0; -+ if(cursor > 0) { -+ memmove(text + cursor + -1, text + cursor, sizeof text - cursor); -+ cursor--; - match(text); - } - break; -@@ -426,13 +442,17 @@ - calcoffsets(); - break; - case XK_Left: -- if(!(sel && sel->left)) -+ if(sel && sel->left){ -+ sel=sel->left; -+ if(sel->right == curr) { -+ curr = prev; -+ calcoffsets(); -+ } -+ } -+ else if(cursor > 0) -+ cursor--; -+ else - return; -- sel=sel->left; -- if(sel->right == curr) { -- curr = prev; -- calcoffsets(); -- } - break; - case XK_Next: - if(!next) -@@ -457,21 +477,29 @@ - running = False; - break; - case XK_Right: -- if(!(sel && sel->right)) -+ if(cursor < len) -+ cursor++; -+ else if(sel && sel->right) { -+ sel=sel->right; -+ if(sel == next) { -+ curr = next; -+ calcoffsets(); -+ } -+ } -+ else - return; -- sel=sel->right; -- if(sel == next) { -- curr = next; -- calcoffsets(); -- } - break; - case XK_Tab: - if(!sel) - return; - strncpy(text, sel->text, sizeof text); -+ cursor = strlen(text); - match(text); - break; - } -+ len = strlen(text); -+ cursor = MIN(cursor, len); -+ cursor = MAX(cursor, 0); - drawmenu(); - } - diff --git a/tools.suckless.org/dmenu/patches/dmenu-tip-paste.diff b/tools.suckless.org/dmenu/patches/dmenu-tip-paste.diff @@ -1,27 +0,0 @@ -diff -r 67d8f41d51d7 dmenu.c ---- a/dmenu.c Fri Jul 02 06:49:05 2010 +0100 -+++ b/dmenu.c Tue Jul 06 18:38:42 2010 -0500 -@@ -254,6 +254,23 @@ - text[++i] = '\0'; - match(); - break; -+ case XK_p: -+ { -+ FILE *fp; -+ char *c; -+ if(!(fp = (FILE*)popen("sselp", "r"))) -+ fprintf(stderr, "dmenu: Could not popen sselp\n"); -+ c = fgets(text + len, sizeof(text) - len, fp); -+ pclose(fp); -+ if(c == NULL) -+ return; -+ } -+ len = strlen(text); -+ if(len && text[len-1] == '\n') -+ text[--len] = '\0'; -+ match(); -+ drawbar(); -+ return; - } - } - switch(ksym) { diff --git a/tools.suckless.org/dmenu/patches/paste.md b/tools.suckless.org/dmenu/patches/paste.md @@ -13,7 +13,6 @@ Download -------- * [dmenu-4.0-paste.diff](dmenu-4.0-paste.diff) (597) (20091029) -* [dmenu-tip-paste.diff](dmenu-tip-paste.diff) (594) (20100706) Author ------ @@ -21,4 +20,4 @@ Author * Evan Gates (emg) <[evan.gates@gmail.com](mailto:evan.gates@gmail.com)> -***Note, this patch is being accepted for mainstream dmenu and in hg tip.*** +***Note, this patch is present in dmenu-4.1.1.*** diff --git a/tools.suckless.org/dmenu/patches/vertical.md b/tools.suckless.org/dmenu/patches/vertical.md @@ -11,4 +11,4 @@ Download * [dmenu-4.0-vertical_meillo.diff](dmenu-4.0-vertical_meillo.diff) -***Note, this patch is being accepted for mainstream dmenu and in hg tip.*** +***Note, this patch is present in dmenu-4.1.1.***