Xinqi Bao's Git
projects
/
dmenu.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
7b1493a
)
add paste from clipboard
author
Connor Lane Smith <
[email protected]
>
Wed, 26 Oct 2011 12:28:15 +0000
(13:28 +0100)
committer
Connor Lane Smith <
[email protected]
>
Wed, 26 Oct 2011 12:28:15 +0000
(13:28 +0100)
dmenu.c
patch
|
blob
|
history
diff --git
a/dmenu.c
b/dmenu.c
index
5e01441
..
3f48d30
100644
(file)
--- a/
dmenu.c
+++ b/
dmenu.c
@@
-52,7
+52,7
@@
static const char *selfgcolor = "#ffffff";
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;
@@
-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;
@@
-517,6
+518,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 */