aboutsummarylogtreecommitdiffstats
path: root/x.c
diff options
context:
space:
mode:
authorDevin J. Pohly2018-02-24 16:16:12 -0600
committerDevin J. Pohly2018-02-25 21:56:26 -0600
commitda33531ed1b5a7a28f192b0b9d8f58aea3187b64 (patch)
tree1f004bb4b9e24e21652ec45b36d636386092d169 /x.c
parent84ceac99b68d7b5408325832465a5d33bb40b677 (diff)
downloadaur-da33531ed1b5a7a28f192b0b9d8f58aea3187b64.tar.gz
Limit usage of extern to config.h globals
Prefer passing arguments to declaring external global variables. The only remaining usage of extern is for config.h variables which are needed in st.c instead of x.c (where it is now included). Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Diffstat (limited to 'x.c')
-rw-r--r--x.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/x.c b/x.c
index 873ff08bb841..970d6dd88167 100644
--- a/x.c
+++ b/x.c
@@ -227,6 +227,8 @@ static char *opt_line = NULL;
static char *opt_name = NULL;
static char *opt_title = NULL;
+static int oldbutton = 3; /* button event on startup: 3 = release */
+
void
clipcopy(const Arg *dummy)
{
@@ -1733,8 +1735,7 @@ cmessage(XEvent *e)
win.mode &= ~MODE_FOCUSED;
}
} else if (e->xclient.data.l[0] == xw.wmdeletewin) {
- /* Send SIGHUP to shell */
- kill(pid, SIGHUP);
+ ttyhangup();
exit(0);
}
}
@@ -1755,6 +1756,7 @@ run(void)
int w = win.w, h = win.h;
fd_set rfd;
int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0;
+ int ttyfd;
struct timespec drawtimeout, *tv = NULL, now, last, lastblink;
long deltatime;
@@ -1774,7 +1776,7 @@ run(void)
}
} while (ev.type != MapNotify);
- ttynew(opt_line, opt_io, opt_cmd);
+ ttyfd = ttynew(opt_line, shell, opt_io, opt_cmd);
cresize(w, h);
clock_gettime(CLOCK_MONOTONIC, &last);
@@ -1782,15 +1784,15 @@ run(void)
for (xev = actionfps;;) {
FD_ZERO(&rfd);
- FD_SET(cmdfd, &rfd);
+ FD_SET(ttyfd, &rfd);
FD_SET(xfd, &rfd);
- if (pselect(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) {
+ if (pselect(MAX(xfd, ttyfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) {
if (errno == EINTR)
continue;
die("select failed: %s\n", strerror(errno));
}
- if (FD_ISSET(cmdfd, &rfd)) {
+ if (FD_ISSET(ttyfd, &rfd)) {
ttyread();
if (blinktimeout) {
blinkset = tattrset(ATTR_BLINK);
@@ -1834,7 +1836,7 @@ run(void)
if (xev && !FD_ISSET(xfd, &rfd))
xev--;
- if (!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) {
+ if (!FD_ISSET(ttyfd, &rfd) && !FD_ISSET(xfd, &rfd)) {
if (blinkset) {
if (TIMEDIFF(now, lastblink) \
> blinktimeout) {