--- st.c | 29 ----------------------------- win.h | 2 +- x.c | 28 +++++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 33 deletions(-) diff --git a/st.c b/st.c index c070f46..306aa69 100644 --- a/st.c +++ b/st.c _AT_@ -47,7 +47,6 @@ #define STR_ARG_SIZ ESC_ARG_SIZ /* macros */ -#define NUMMAXLEN(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) #define DEFAULT(a, b) (a) = (a) ? (a) : (b) #define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) == '\177') #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) _AT_@ -55,8 +54,6 @@ #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) /* constants */ -#define ISO14755CMD "dmenu -w %lu -p codepoint: </dev/null" - enum cursor_movement { CURSOR_SAVE, CURSOR_LOAD _AT_@ -127,7 +124,6 @@ static void numlock(const Arg *); static void selpaste(const Arg *); static void printsel(const Arg *); static void printscreen(const Arg *) ; -static void iso14755(const Arg *); static void toggleprinter(const Arg *); static void sendbreak(const Arg *); _AT_@ -1982,31 +1978,6 @@ tprinter(char *s, size_t len) } } -void -iso14755(const Arg *arg) -{ - unsigned long id = xwinid(); - char cmd[sizeof(ISO14755CMD) + NUMMAXLEN(id)]; - FILE *p; - char *us, *e, codepoint[9], uc[UTF_SIZ]; - unsigned long utf32; - - snprintf(cmd, sizeof(cmd), ISO14755CMD, id); - if (!(p = popen(cmd, "r"))) - return; - - us = fgets(codepoint, sizeof(codepoint), p); - pclose(p); - - if (!us || *us == '\0' || *us == '-' || strlen(us) > 7) - return; - if ((utf32 = strtoul(us, &e, 16)) == ULONG_MAX || - (*e != '\n' && *e != '\0')) - return; - - ttysend(uc, utf8encode(utf32, uc)); -} - void toggleprinter(const Arg *arg) { diff --git a/win.h b/win.h index 2454b50..bd2456b 100644 --- a/win.h +++ b/win.h _AT_@ -8,6 +8,7 @@ void draw(void); void drawregion(int, int, int, int); +void iso14755(const Arg *); void xbell(void); void xclipcopy(void); void xclippaste(void); _AT_@ -20,7 +21,6 @@ void xsetpointermotion(int); void xunloadfonts(void); void xresize(int, int); void xselpaste(void); -unsigned long xwinid(void); void xsetsel(char *, Time); void zoom(const Arg *); void zoomabs(const Arg *); diff --git a/x.c b/x.c index 529cb48..3099985 100644 --- a/x.c +++ b/x.c _AT_@ -25,7 +25,11 @@ static char *argv0; #define XEMBED_FOCUS_IN 4 #define XEMBED_FOCUS_OUT 5 +/* constants */ +#define ISO14755CMD "dmenu -w %lu -p codepoint: </dev/null" + /* macros */ +#define NUMMAXLEN(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) #define TRUERED(x) (((x) & 0xff0000) >> 8) #define TRUEGREEN(x) (((x) & 0xff00)) #define TRUEBLUE(x) (((x) & 0xff) << 8) _AT_@ -1523,10 +1527,28 @@ xbell(void) XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); } -unsigned long -xwinid(void) +void +iso14755(const Arg *arg) { - return xw.win; + char cmd[sizeof(ISO14755CMD) + NUMMAXLEN(xw.win)]; + FILE *p; + char *us, *e, codepoint[9], uc[UTF_SIZ]; + unsigned long utf32; + + snprintf(cmd, sizeof(cmd), ISO14755CMD, xw.win); + if (!(p = popen(cmd, "r"))) + return; + + us = fgets(codepoint, sizeof(codepoint), p); + pclose(p); + + if (!us || *us == '\0' || *us == '-' || strlen(us) > 7) + return; + if ((utf32 = strtoul(us, &e, 16)) == ULONG_MAX || + (*e != '\n' && *e != '\0')) + return; + + ttysend(uc, utf8encode(utf32, uc)); } void -- 2.14.1Received on Sun Sep 24 2017 - 23:11:27 CEST
This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:24:45 CEST