Xinqi Bao's Git
projects
/
dmenu.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
replace lsx with stest
[dmenu.git]
/
dmenu.c
diff --git
a/dmenu.c
b/dmenu.c
index
5e01441
..
99db24e
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-45,14
+45,14
@@
static int inputw, promptw;
static size_t cursor = 0;
static const char *font = NULL;
static const char *prompt = NULL;
static size_t cursor = 0;
static const char *font = NULL;
static const char *prompt = NULL;
-static const char *normbgcolor = "#
cccccc
";
-static const char *normfgcolor = "#
000000
";
-static const char *selbgcolor = "#00
66ff
";
-static const char *selfgcolor = "#
ffffff
";
+static const char *normbgcolor = "#
222222
";
+static const char *normfgcolor = "#
bbbbbb
";
+static const char *selbgcolor = "#00
5577
";
+static const char *selfgcolor = "#
eeeeee
";
static unsigned int lines = 0;
static unsigned long normcol[ColLast];
static unsigned long selcol[ColLast];
static unsigned int lines = 0;
static unsigned long normcol[ColLast];
static unsigned long selcol[ColLast];
-static Atom utf8;
+static Atom
clip,
utf8;
static Bool topbar = True;
static DC *dc;
static Item *items = NULL;
static Bool topbar = True;
static DC *dc;
static Item *items = NULL;
@@
-258,8
+258,8
@@
keypress(XKeyEvent *ev) {
case XK_i: ksym = XK_Tab; break;
case XK_j: ksym = XK_Return; break;
case XK_m: ksym = XK_Return; break;
case XK_i: ksym = XK_Tab; break;
case XK_j: ksym = XK_Return; break;
case XK_m: ksym = XK_Return; break;
- case XK_n: ksym = XK_
Up;
break;
- case XK_p: ksym = XK_
Down;
break;
+ case XK_n: ksym = XK_
Down;
break;
+ case XK_p: ksym = XK_
Up;
break;
case XK_k: /* delete right */
text[cursor] = '\0';
case XK_k: /* delete right */
text[cursor] = '\0';
@@
-275,7
+275,8
@@
keypress(XKeyEvent *ev) {
insert(NULL, nextrune(-1) - cursor);
break;
case XK_y: /* paste selection */
insert(NULL, nextrune(-1) - cursor);
break;
case XK_y: /* paste selection */
- XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime);
+ XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
+ utf8, utf8, win, CurrentTime);
return;
default:
return;
return;
default:
return;
@@
-327,6
+328,8
@@
keypress(XKeyEvent *ev) {
cursor = nextrune(-1);
break;
}
cursor = nextrune(-1);
break;
}
+ if(lines > 0)
+ return;
/* fallthrough */
case XK_Up:
if(sel && sel->left && (sel = sel->left)->right == curr) {
/* fallthrough */
case XK_Up:
if(sel && sel->left && (sel = sel->left)->right == curr) {
@@
-355,6
+358,8
@@
keypress(XKeyEvent *ev) {
cursor = nextrune(+1);
break;
}
cursor = nextrune(+1);
break;
}
+ if(lines > 0)
+ return;
/* fallthrough */
case XK_Down:
if(sel && sel->right && (sel = sel->right) == next) {
/* fallthrough */
case XK_Down:
if(sel && sel->right && (sel = sel->right) == next) {
@@
-517,6
+522,7
@@
setup(void) {
selcol[ColBG] = getcolor(dc, selbgcolor);
selcol[ColFG] = getcolor(dc, selfgcolor);
selcol[ColBG] = getcolor(dc, selbgcolor);
selcol[ColFG] = getcolor(dc, selfgcolor);
+ clip = XInternAtom(dc->dpy, "CLIPBOARD", False);
utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
/* calculate menu geometry */
utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False);
/* calculate menu geometry */