diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2017-10-17 15:43:32 -0500 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:53:24 -0600 |
commit | 428f01969aaf48ffa2983746c0a397bcc8946799 (patch) | |
tree | 5ad1ccfaf6ac0599498b0d7795fe7002b365d19f | |
parent | 65976c1a29f2945c3cfb6af74cd6440cf193021d (diff) | |
download | st-patched-428f01969aaf48ffa2983746c0a397bcc8946799.tar.bz2 st-patched-428f01969aaf48ffa2983746c0a397bcc8946799.tar.xz st-patched-428f01969aaf48ffa2983746c0a397bcc8946799.zip |
Inline clipboard functions
No need to keep a function that only calls another function in the same
file.
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
-rw-r--r-- | win.h | 2 | ||||
-rw-r--r-- | x.c | 50 |
2 files changed, 19 insertions, 33 deletions
@@ -10,11 +10,9 @@ void drawregion(int, int, int, int); | |||
10 | 10 | ||
11 | void xbell(void); | 11 | void xbell(void); |
12 | void xclipcopy(void); | 12 | void xclipcopy(void); |
13 | void xclippaste(void); | ||
14 | void xhints(void); | 13 | void xhints(void); |
15 | void xloadcols(void); | 14 | void xloadcols(void); |
16 | int xsetcolorname(int, const char *); | 15 | int xsetcolorname(int, const char *); |
17 | void xsettitle(char *); | 16 | void xsettitle(char *); |
18 | void xsetpointermotion(int); | 17 | void xsetpointermotion(int); |
19 | void xselpaste(void); | ||
20 | void xsetsel(char *, Time); | 18 | void xsetsel(char *, Time); |
@@ -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); |