[hackers] [st] Remove Time argument from xsetsel || Devin J. Pohly

From: <git_AT_suckless.org>
Date: Fri, 9 Mar 2018 15:37:38 +0100 (CET)

commit 3bb900cd6c1c7a5364bd79bce63fdd8711bc878b
Author: Devin J. Pohly <djpohly_AT_gmail.com>
AuthorDate: Mon Nov 6 18:25:58 2017 -0600
Commit: Devin J. Pohly <djpohly_AT_gmail.com>
CommitDate: Sun Feb 25 21:53:24 2018 -0600

    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_AT_gmail.com>

diff --git a/st.c b/st.c
index fdf697b..bcb6473 100644
--- a/st.c
+++ b/st.c
_AT_@ -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 c6a5337..f95a679 100644
--- a/win.h
+++ b/win.h
_AT_@ -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 04e2e05..a332ac9 100644
--- a/x.c
+++ b/x.c
_AT_@ -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);
_AT_@ -441,12 +441,6 @@ bpress(XEvent *e)
 }
 
 void
-selcopy(Time t)
-{
- xsetsel(getsel(), t);
-}
-
-void
 propnotify(XEvent *e)
 {
         XPropertyEvent *xpev;
_AT_@ -620,7 +614,7 @@ selrequest(XEvent *e)
 }
 
 void
-xsetsel(char *str, Time t)
+setsel(char *str, Time t)
 {
         free(sel.primary);
         sel.primary = str;
_AT_@ -631,6 +625,12 @@ xsetsel(char *str, Time t)
 }
 
 void
+xsetsel(char *str)
+{
+ setsel(str, CurrentTime);
+}
+
+void
 brelease(XEvent *e)
 {
         if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
_AT_@ -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;
Received on Fri Mar 09 2018 - 15:37:38 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 09 2018 - 15:49:49 CET