[hackers] [dmenu] applied multisel patch to mainline || Anselm R Garbe
commit 0d12a47415edba5db73f56dba76f123394581387
Author: Anselm R Garbe <anselm_AT_garbe.us>
Date: Wed Apr 17 20:56:54 2013 +0200
applied multisel patch to mainline
diff --git a/dmenu.1 b/dmenu.1
index 3a0f4ef..88f77de 100644
--- a/dmenu.1
+++ b/dmenu.1
_AT_@ -83,6 +83,9 @@ Copy the selected item to the input field.
Confirm selection. Prints the selected item to stdout and exits, returning
success.
.TP
+.B Ctrl-Return
+Confirm selection. Prints the selected item to stdout and continues.
+.TP
.B Shift\-Return
Confirm input. Prints the input text to stdout and exits, returning success.
.TP
diff --git a/dmenu.c b/dmenu.c
index 3962801..efc1e54 100644
--- a/dmenu.c
+++ b/dmenu.c
_AT_@ -22,6 +22,7 @@ typedef struct Item Item;
struct Item {
char *text;
Item *left, *right;
+ Bool out;
};
static void appenditem(Item *item, Item **list, Item **last);
_AT_@ -49,9 +50,12 @@ static const char *normbgcolor = "#222222";
static const char *normfgcolor = "#bbbbbb";
static const char *selbgcolor = "#005577";
static const char *selfgcolor = "#eeeeee";
+static const char *outbgcolor = "#00ffff";
+static const char *outfgcolor = "#000000";
static unsigned int lines = 0;
static unsigned long normcol[ColLast];
static unsigned long selcol[ColLast];
+static unsigned long outcol[ColLast];
static Atom clip, utf8;
static Bool topbar = True;
static DC *dc;
_AT_@ -185,7 +189,8 @@ drawmenu(void) {
dc->w = mw - dc->x;
for(item = curr; item != next; item = item->right) {
dc->y += dc->h;
- drawtext(dc, item->text, (item == sel) ? selcol : normcol);
+ drawtext(dc, item->text, (item == sel) ? selcol :
+ (item->out) ? outcol : normcol);
}
}
else if(matches) {
_AT_@ -197,7 +202,8 @@ drawmenu(void) {
for(item = curr; item != next; item = item->right) {
dc->x += dc->w;
dc->w = MIN(textw(dc, item->text), mw - dc->x - textw(dc, ">"));
- drawtext(dc, item->text, (item == sel) ? selcol : normcol);
+ drawtext(dc, item->text, (item == sel) ? selcol :
+ (item->out) ? outcol : normcol);
}
dc->w = textw(dc, ">");
dc->x = mw - dc->w;
_AT_@ -278,6 +284,9 @@ keypress(XKeyEvent *ev) {
XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
utf8, utf8, win, CurrentTime);
return;
+ case XK_Return:
+ case XK_KP_Enter:
+ break;
default:
return;
}
_AT_@ -362,7 +371,10 @@ keypress(XKeyEvent *ev) {
case XK_Return:
case XK_KP_Enter:
puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
- exit(EXIT_SUCCESS);
+ if(!(ev->state & ControlMask))
+ exit(EXIT_SUCCESS);
+ sel->out = True;
+ break;
case XK_Right:
if(text[cursor] != '
Received on Wed Apr 17 2013 - 20:56:25 CEST
This archive was generated by hypermail 2.3.0
: Wed Apr 17 2013 - 21:00:16 CEST