diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2017-10-10 10:30:23 -0500 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2018-02-25 21:53:24 -0600 |
commit | 3e44ee5569a81ba6f06e1ecd19bf0ceb1e97f18d (patch) | |
tree | f1ae3a269e18cdff7638c7fe9eabe9a2bbab24b8 /st.c | |
parent | 1f24bde82b19912c080fbb4a0b153a248cd6c6ea (diff) | |
download | st-3e44ee5569a81ba6f06e1ecd19bf0ceb1e97f18d.tar.gz st-3e44ee5569a81ba6f06e1ecd19bf0ceb1e97f18d.zip |
Call xsetenv() in main process instead of child
This makes xsetenv internal to x.c, and allows iso14755's external
command to use $WINDOWID instead of having to snprintf it again. (The
same benefit will apply to the externalpipe patch.) The xwinid function
is no longer needed.
Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 8 |
1 files changed, 2 insertions, 6 deletions
@@ -60,7 +60,7 @@ char *argv0; | |||
60 | #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) | 60 | #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) |
61 | 61 | ||
62 | /* constants */ | 62 | /* constants */ |
63 | #define ISO14755CMD "dmenu -w %lu -p codepoint: </dev/null" | 63 | #define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: </dev/null" |
64 | 64 | ||
65 | enum cursor_movement { | 65 | enum cursor_movement { |
66 | CURSOR_SAVE, | 66 | CURSOR_SAVE, |
@@ -706,7 +706,6 @@ execsh(void) | |||
706 | setenv("SHELL", sh, 1); | 706 | setenv("SHELL", sh, 1); |
707 | setenv("HOME", pw->pw_dir, 1); | 707 | setenv("HOME", pw->pw_dir, 1); |
708 | setenv("TERM", termname, 1); | 708 | setenv("TERM", termname, 1); |
709 | xsetenv(); | ||
710 | 709 | ||
711 | signal(SIGCHLD, SIG_DFL); | 710 | signal(SIGCHLD, SIG_DFL); |
712 | signal(SIGHUP, SIG_DFL); | 711 | signal(SIGHUP, SIG_DFL); |
@@ -1993,14 +1992,11 @@ tprinter(char *s, size_t len) | |||
1993 | void | 1992 | void |
1994 | iso14755(const Arg *arg) | 1993 | iso14755(const Arg *arg) |
1995 | { | 1994 | { |
1996 | unsigned long id = xwinid(); | ||
1997 | char cmd[sizeof(ISO14755CMD) + NUMMAXLEN(id)]; | ||
1998 | FILE *p; | 1995 | FILE *p; |
1999 | char *us, *e, codepoint[9], uc[UTF_SIZ]; | 1996 | char *us, *e, codepoint[9], uc[UTF_SIZ]; |
2000 | unsigned long utf32; | 1997 | unsigned long utf32; |
2001 | 1998 | ||
2002 | snprintf(cmd, sizeof(cmd), ISO14755CMD, id); | 1999 | if (!(p = popen(ISO14755CMD, "r"))) |
2003 | if (!(p = popen(cmd, "r"))) | ||
2004 | return; | 2000 | return; |
2005 | 2001 | ||
2006 | us = fgets(codepoint, sizeof(codepoint), p); | 2002 | us = fgets(codepoint, sizeof(codepoint), p); |