aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2017-11-06 18:25:58 -0600
committerDevin J. Pohly <djpohly@gmail.com>2018-02-25 21:53:24 -0600
commit3bb900cd6c1c7a5364bd79bce63fdd8711bc878b (patch)
tree854f906a109a0de83576ee2d8183c1eb4477adf6
parent323d38da20c8a1d295ab1dbc0fc7ce947ef824e1 (diff)
downloadst-patched-3bb900cd6c1c7a5364bd79bce63fdd8711bc878b.tar.bz2
st-patched-3bb900cd6c1c7a5364bd79bce63fdd8711bc878b.tar.xz
st-patched-3bb900cd6c1c7a5364bd79bce63fdd8711bc878b.zip
Remove Time argument from xsetsel
This is an X type and should be internal to x.c. The selcopy() function was a single line and only used in one place, so it was inlined to reduce LOC. Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
-rw-r--r--st.c2
-rw-r--r--win.h2
-rw-r--r--x.c18
3 files changed, 11 insertions, 11 deletions
diff --git a/st.c b/st.c
index fdf697b..bcb6473 100644
--- a/st.c
+++ b/st.c
@@ -1747,7 +1747,7 @@ strhandle(void)
1747 1747
1748 dec = base64dec(strescseq.args[2]); 1748 dec = base64dec(strescseq.args[2]);
1749 if (dec) { 1749 if (dec) {
1750 xsetsel(dec, CurrentTime); 1750 xsetsel(dec);
1751 xclipcopy(); 1751 xclipcopy();
1752 } else { 1752 } else {
1753 fprintf(stderr, "erresc: invalid base64\n"); 1753 fprintf(stderr, "erresc: invalid base64\n");
diff --git a/win.h b/win.h
index c6a5337..f95a679 100644
--- a/win.h
+++ b/win.h
@@ -16,4 +16,4 @@ int xsetcolorname(int, const char *);
16void xsettitle(char *); 16void xsettitle(char *);
17int xsetcursor(int); 17int xsetcursor(int);
18void xsetpointermotion(int); 18void xsetpointermotion(int);
19void xsetsel(char *, Time); 19void xsetsel(char *);
diff --git a/x.c b/x.c
index 04e2e05..a332ac9 100644
--- a/x.c
+++ b/x.c
@@ -148,7 +148,7 @@ static void propnotify(XEvent *);
148static void selnotify(XEvent *); 148static void selnotify(XEvent *);
149static void selclear_(XEvent *); 149static void selclear_(XEvent *);
150static void selrequest(XEvent *); 150static void selrequest(XEvent *);
151static void selcopy(Time); 151static void setsel(char *, Time);
152static void getbuttoninfo(XEvent *); 152static void getbuttoninfo(XEvent *);
153static void mousereport(XEvent *); 153static void mousereport(XEvent *);
154static char *kmap(KeySym, uint); 154static char *kmap(KeySym, uint);
@@ -441,12 +441,6 @@ bpress(XEvent *e)
441} 441}
442 442
443void 443void
444selcopy(Time t)
445{
446 xsetsel(getsel(), t);
447}
448
449void
450propnotify(XEvent *e) 444propnotify(XEvent *e)
451{ 445{
452 XPropertyEvent *xpev; 446 XPropertyEvent *xpev;
@@ -620,7 +614,7 @@ selrequest(XEvent *e)
620} 614}
621 615
622void 616void
623xsetsel(char *str, Time t) 617setsel(char *str, Time t)
624{ 618{
625 free(sel.primary); 619 free(sel.primary);
626 sel.primary = str; 620 sel.primary = str;
@@ -631,6 +625,12 @@ xsetsel(char *str, Time t)
631} 625}
632 626
633void 627void
628xsetsel(char *str)
629{
630 setsel(str, CurrentTime);
631}
632
633void
634brelease(XEvent *e) 634brelease(XEvent *e)
635{ 635{
636 if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { 636 if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
@@ -643,7 +643,7 @@ brelease(XEvent *e)
643 } else if (e->xbutton.button == Button1) { 643 } else if (e->xbutton.button == Button1) {
644 if (sel.mode == SEL_READY) { 644 if (sel.mode == SEL_READY) {
645 getbuttoninfo(e); 645 getbuttoninfo(e);
646 selcopy(e->xbutton.time); 646 setsel(getsel(), e->xbutton.time);
647 } else 647 } else
648 selclear_(NULL); 648 selclear_(NULL);
649 sel.mode = SEL_IDLE; 649 sel.mode = SEL_IDLE;