diff options
Diffstat (limited to 'x.c')
-rw-r--r-- | x.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -227,6 +227,8 @@ static char *opt_line = NULL; | |||
227 | static char *opt_name = NULL; | 227 | static char *opt_name = NULL; |
228 | static char *opt_title = NULL; | 228 | static char *opt_title = NULL; |
229 | 229 | ||
230 | static int oldbutton = 3; /* button event on startup: 3 = release */ | ||
231 | |||
230 | void | 232 | void |
231 | clipcopy(const Arg *dummy) | 233 | clipcopy(const Arg *dummy) |
232 | { | 234 | { |
@@ -1733,8 +1735,7 @@ cmessage(XEvent *e) | |||
1733 | win.mode &= ~MODE_FOCUSED; | 1735 | win.mode &= ~MODE_FOCUSED; |
1734 | } | 1736 | } |
1735 | } else if (e->xclient.data.l[0] == xw.wmdeletewin) { | 1737 | } else if (e->xclient.data.l[0] == xw.wmdeletewin) { |
1736 | /* Send SIGHUP to shell */ | 1738 | ttyhangup(); |
1737 | kill(pid, SIGHUP); | ||
1738 | exit(0); | 1739 | exit(0); |
1739 | } | 1740 | } |
1740 | } | 1741 | } |
@@ -1755,6 +1756,7 @@ run(void) | |||
1755 | int w = win.w, h = win.h; | 1756 | int w = win.w, h = win.h; |
1756 | fd_set rfd; | 1757 | fd_set rfd; |
1757 | int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0; | 1758 | int xfd = XConnectionNumber(xw.dpy), xev, blinkset = 0, dodraw = 0; |
1759 | int ttyfd; | ||
1758 | struct timespec drawtimeout, *tv = NULL, now, last, lastblink; | 1760 | struct timespec drawtimeout, *tv = NULL, now, last, lastblink; |
1759 | long deltatime; | 1761 | long deltatime; |
1760 | 1762 | ||
@@ -1774,7 +1776,7 @@ run(void) | |||
1774 | } | 1776 | } |
1775 | } while (ev.type != MapNotify); | 1777 | } while (ev.type != MapNotify); |
1776 | 1778 | ||
1777 | ttynew(opt_line, opt_io, opt_cmd); | 1779 | ttyfd = ttynew(opt_line, shell, opt_io, opt_cmd); |
1778 | cresize(w, h); | 1780 | cresize(w, h); |
1779 | 1781 | ||
1780 | clock_gettime(CLOCK_MONOTONIC, &last); | 1782 | clock_gettime(CLOCK_MONOTONIC, &last); |
@@ -1782,15 +1784,15 @@ run(void) | |||
1782 | 1784 | ||
1783 | for (xev = actionfps;;) { | 1785 | for (xev = actionfps;;) { |
1784 | FD_ZERO(&rfd); | 1786 | FD_ZERO(&rfd); |
1785 | FD_SET(cmdfd, &rfd); | 1787 | FD_SET(ttyfd, &rfd); |
1786 | FD_SET(xfd, &rfd); | 1788 | FD_SET(xfd, &rfd); |
1787 | 1789 | ||
1788 | if (pselect(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { | 1790 | if (pselect(MAX(xfd, ttyfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) { |
1789 | if (errno == EINTR) | 1791 | if (errno == EINTR) |
1790 | continue; | 1792 | continue; |
1791 | die("select failed: %s\n", strerror(errno)); | 1793 | die("select failed: %s\n", strerror(errno)); |
1792 | } | 1794 | } |
1793 | if (FD_ISSET(cmdfd, &rfd)) { | 1795 | if (FD_ISSET(ttyfd, &rfd)) { |
1794 | ttyread(); | 1796 | ttyread(); |
1795 | if (blinktimeout) { | 1797 | if (blinktimeout) { |
1796 | blinkset = tattrset(ATTR_BLINK); | 1798 | blinkset = tattrset(ATTR_BLINK); |
@@ -1834,7 +1836,7 @@ run(void) | |||
1834 | 1836 | ||
1835 | if (xev && !FD_ISSET(xfd, &rfd)) | 1837 | if (xev && !FD_ISSET(xfd, &rfd)) |
1836 | xev--; | 1838 | xev--; |
1837 | if (!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) { | 1839 | if (!FD_ISSET(ttyfd, &rfd) && !FD_ISSET(xfd, &rfd)) { |
1838 | if (blinkset) { | 1840 | if (blinkset) { |
1839 | if (TIMEDIFF(now, lastblink) \ | 1841 | if (TIMEDIFF(now, lastblink) \ |
1840 | > blinktimeout) { | 1842 | > blinktimeout) { |