]> git.armaanb.net Git - st.git/commitdiff
Remove Time argument from xsetsel
authorDevin J. Pohly <djpohly@gmail.com>
Tue, 7 Nov 2017 00:25:58 +0000 (18:25 -0600)
committerDevin J. Pohly <djpohly@gmail.com>
Mon, 26 Feb 2018 03:53:24 +0000 (21:53 -0600)
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>
st.c
win.h
x.c

diff --git a/st.c b/st.c
index fdf697bfe14f9b943b7ffd62d09222120ec5e73e..bcb64732947a484a682febd25f31fa828dd0fb7b 100644 (file)
--- a/st.c
+++ b/st.c
@@ -1747,7 +1747,7 @@ strhandle(void)
 
                                dec = base64dec(strescseq.args[2]);
                                if (dec) {
-                                       xsetsel(dec, CurrentTime);
+                                       xsetsel(dec);
                                        xclipcopy();
                                } else {
                                        fprintf(stderr, "erresc: invalid base64\n");
diff --git a/win.h b/win.h
index c6a5337680adec0e2a4544fc42e582a56d232a5b..f95a6790db7a19936b2ab84f0079ef6d6ce78d60 100644 (file)
--- a/win.h
+++ b/win.h
@@ -16,4 +16,4 @@ int xsetcolorname(int, const char *);
 void xsettitle(char *);
 int xsetcursor(int);
 void xsetpointermotion(int);
-void xsetsel(char *, Time);
+void xsetsel(char *);
diff --git a/x.c b/x.c
index 04e2e053b9f4a505c5fe2fa255d4ed6a9806cfce..a332ac9386272404aa3d563cfd11ed7740959484 100644 (file)
--- a/x.c
+++ b/x.c
@@ -148,7 +148,7 @@ static void propnotify(XEvent *);
 static void selnotify(XEvent *);
 static void selclear_(XEvent *);
 static void selrequest(XEvent *);
-static void selcopy(Time);
+static void setsel(char *, Time);
 static void getbuttoninfo(XEvent *);
 static void mousereport(XEvent *);
 static char *kmap(KeySym, uint);
@@ -440,12 +440,6 @@ bpress(XEvent *e)
        }
 }
 
-void
-selcopy(Time t)
-{
-       xsetsel(getsel(), t);
-}
-
 void
 propnotify(XEvent *e)
 {
@@ -620,7 +614,7 @@ selrequest(XEvent *e)
 }
 
 void
-xsetsel(char *str, Time t)
+setsel(char *str, Time t)
 {
        free(sel.primary);
        sel.primary = str;
@@ -630,6 +624,12 @@ xsetsel(char *str, Time t)
                selclear_(NULL);
 }
 
+void
+xsetsel(char *str)
+{
+       setsel(str, CurrentTime);
+}
+
 void
 brelease(XEvent *e)
 {
@@ -643,7 +643,7 @@ brelease(XEvent *e)
        } else if (e->xbutton.button == Button1) {
                if (sel.mode == SEL_READY) {
                        getbuttoninfo(e);
-                       selcopy(e->xbutton.time);
+                       setsel(getsel(), e->xbutton.time);
                } else
                        selclear_(NULL);
                sel.mode = SEL_IDLE;