diff options
author | Connor Lane Smith <cls@lubutu.com> | 2011-10-26 13:28:15 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2011-10-26 13:28:15 +0100 |
commit | dc77337ef35a52e1da8a74339bc39f32e6e5ab56 (patch) | |
tree | cd7b5c684365322e46983c45e6c5e3a796bcf169 | |
parent | 7b1493a63162875ba591883e480bd36a063cf222 (diff) |
add paste from clipboard
-rw-r--r-- | dmenu.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -52,7 +52,7 @@ static const char *selfgcolor = "#ffffff"; | |||
52 | static unsigned int lines = 0; | 52 | static unsigned int lines = 0; |
53 | static unsigned long normcol[ColLast]; | 53 | static unsigned long normcol[ColLast]; |
54 | static unsigned long selcol[ColLast]; | 54 | static unsigned long selcol[ColLast]; |
55 | static Atom utf8; | 55 | static Atom clip, utf8; |
56 | static Bool topbar = True; | 56 | static Bool topbar = True; |
57 | static DC *dc; | 57 | static DC *dc; |
58 | static Item *items = NULL; | 58 | static Item *items = NULL; |
@@ -275,7 +275,8 @@ keypress(XKeyEvent *ev) { | |||
275 | insert(NULL, nextrune(-1) - cursor); | 275 | insert(NULL, nextrune(-1) - cursor); |
276 | break; | 276 | break; |
277 | case XK_y: /* paste selection */ | 277 | case XK_y: /* paste selection */ |
278 | XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime); | 278 | XConvertSelection(dc->dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY, |
279 | utf8, utf8, win, CurrentTime); | ||
279 | return; | 280 | return; |
280 | default: | 281 | default: |
281 | return; | 282 | return; |
@@ -517,6 +518,7 @@ setup(void) { | |||
517 | selcol[ColBG] = getcolor(dc, selbgcolor); | 518 | selcol[ColBG] = getcolor(dc, selbgcolor); |
518 | selcol[ColFG] = getcolor(dc, selfgcolor); | 519 | selcol[ColFG] = getcolor(dc, selfgcolor); |
519 | 520 | ||
521 | clip = XInternAtom(dc->dpy, "CLIPBOARD", False); | ||
520 | utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); | 522 | utf8 = XInternAtom(dc->dpy, "UTF8_STRING", False); |
521 | 523 | ||
522 | /* calculate menu geometry */ | 524 | /* calculate menu geometry */ |