diff options
Diffstat (limited to 'x.c')
| -rw-r--r-- | x.c | 50 |
1 files changed, 19 insertions, 31 deletions
| @@ -210,19 +210,33 @@ static char *opt_title = NULL; | |||
| 210 | void | 210 | void |
| 211 | clipcopy(const Arg *dummy) | 211 | clipcopy(const Arg *dummy) |
| 212 | { | 212 | { |
| 213 | xclipcopy(); | 213 | Atom clipboard; |
| 214 | |||
| 215 | if (sel.clipboard != NULL) | ||
| 216 | free(sel.clipboard); | ||
| 217 | |||
| 218 | if (sel.primary != NULL) { | ||
| 219 | sel.clipboard = xstrdup(sel.primary); | ||
| 220 | clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0); | ||
| 221 | XSetSelectionOwner(xw.dpy, clipboard, xw.win, CurrentTime); | ||
| 222 | } | ||
| 214 | } | 223 | } |
| 215 | 224 | ||
| 216 | void | 225 | void |
| 217 | clippaste(const Arg *dummy) | 226 | clippaste(const Arg *dummy) |
| 218 | { | 227 | { |
| 219 | xclippaste(); | 228 | Atom clipboard; |
| 229 | |||
| 230 | clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0); | ||
| 231 | XConvertSelection(xw.dpy, clipboard, xsel.xtarget, clipboard, | ||
| 232 | xw.win, CurrentTime); | ||
| 220 | } | 233 | } |
| 221 | 234 | ||
| 222 | void | 235 | void |
| 223 | selpaste(const Arg *dummy) | 236 | selpaste(const Arg *dummy) |
| 224 | { | 237 | { |
| 225 | xselpaste(); | 238 | XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY, |
| 239 | xw.win, CurrentTime); | ||
| 226 | } | 240 | } |
| 227 | 241 | ||
| 228 | void | 242 | void |
| @@ -519,35 +533,9 @@ selnotify(XEvent *e) | |||
| 519 | } | 533 | } |
| 520 | 534 | ||
| 521 | void | 535 | void |
| 522 | xselpaste(void) | ||
| 523 | { | ||
| 524 | XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY, | ||
| 525 | xw.win, CurrentTime); | ||
| 526 | } | ||
| 527 | |||
| 528 | void | ||
| 529 | xclipcopy(void) | 536 | xclipcopy(void) |
| 530 | { | 537 | { |
| 531 | Atom clipboard; | 538 | clipcopy(NULL); |
| 532 | |||
| 533 | if (sel.clipboard != NULL) | ||
| 534 | free(sel.clipboard); | ||
| 535 | |||
| 536 | if (sel.primary != NULL) { | ||
| 537 | sel.clipboard = xstrdup(sel.primary); | ||
| 538 | clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0); | ||
| 539 | XSetSelectionOwner(xw.dpy, clipboard, xw.win, CurrentTime); | ||
| 540 | } | ||
| 541 | } | ||
| 542 | |||
| 543 | void | ||
| 544 | xclippaste(void) | ||
| 545 | { | ||
| 546 | Atom clipboard; | ||
| 547 | |||
| 548 | clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0); | ||
| 549 | XConvertSelection(xw.dpy, clipboard, xsel.xtarget, clipboard, | ||
| 550 | xw.win, CurrentTime); | ||
| 551 | } | 539 | } |
| 552 | 540 | ||
| 553 | void | 541 | void |
| @@ -634,7 +622,7 @@ brelease(XEvent *e) | |||
| 634 | } | 622 | } |
| 635 | 623 | ||
| 636 | if (e->xbutton.button == Button2) { | 624 | if (e->xbutton.button == Button2) { |
| 637 | xselpaste(); | 625 | selpaste(NULL); |
| 638 | } else if (e->xbutton.button == Button1) { | 626 | } else if (e->xbutton.button == Button1) { |
| 639 | if (sel.mode == SEL_READY) { | 627 | if (sel.mode == SEL_READY) { |
| 640 | getbuttoninfo(e); | 628 | getbuttoninfo(e); |
