[hackers] [st][PATCH 16/23] Remove need for CurrentTime in st.c

From: Devin J. Pohly <djpohly_AT_gmail.com>
Date: Sun, 24 Sep 2017 16:11:38 -0500

Moving closer to removing that module's dependency on Xlib
---
 st.c  |  2 +-
 win.h |  2 +-
 x.c   | 19 +++++++++----------
 3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/st.c b/st.c
index 2bf9435..00214d3 100644
--- a/st.c
+++ b/st.c
_AT_@ -1800,7 +1800,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 c4b5566..5e1f7fe 100644
--- a/win.h
+++ b/win.h
_AT_@ -19,7 +19,7 @@ int xsetcolorname(int, const char *);
 void xsetenv(void);
 void xsettitle(char *);
 void xsetpointermotion(int);
-void xsetsel(char *, Time);
+void xsetsel(char *);
 void zoom(const Arg *);
 void zoomabs(const Arg *);
 void zoomreset(const Arg *);
diff --git a/x.c b/x.c
index 8abe238..c8660e3 100644
--- a/x.c
+++ b/x.c
_AT_@ -115,9 +115,8 @@ static void propnotify(XEvent *);
 static void selnotify(XEvent *);
 static void selclear_(XEvent *);
 static void selrequest(XEvent *);
-
-static void selcopy(Time);
 static void selinit(void);
+static void setsel(char *, Time);
 static int match(uint, uint);
 static char *kmap(KeySym, uint);
 
_AT_@ -360,12 +359,6 @@ bpress(XEvent *e)
 	}
 }
 
-void
-selcopy(Time t)
-{
-	xsetsel(getsel(), t);
-}
-
 void
 propnotify(XEvent *e)
 {
_AT_@ -603,7 +596,7 @@ selrequest(XEvent *e)
 }
 
 void
-xsetsel(char *str, Time t)
+setsel(char *str, Time t)
 {
 	free(sel.primary);
 	sel.primary = str;
_AT_@ -613,6 +606,12 @@ xsetsel(char *str, Time t)
 		selclear_(NULL);
 }
 
+void
+xsetsel(char *str)
+{
+	setsel(str, CurrentTime);
+}
+
 void
 brelease(XEvent *e)
 {
_AT_@ -626,7 +625,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;
-- 
2.14.1
Received on Sun Sep 24 2017 - 23:11:38 CEST

This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:26:19 CEST