aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2015-07-09 23:59:50 +0200
committerChristoph Lohmann <20h@r-36.net>2015-07-10 13:58:09 +0200
commit13233574ed1ead29bb7e99e71a0665e62c640617 (patch)
tree266ca14d1c85787535d39784f6c148bc33456f4b /st.c
parent9de853a98da8fe0f458b244970f0e0d3e9b38a50 (diff)
downloadst-13233574ed1ead29bb7e99e71a0665e62c640617.tar.gz
st-13233574ed1ead29bb7e99e71a0665e62c640617.zip
Use BSD-style function notation
Put the opening brace on a new line. This was already used for some functions inside st.c. Signed-off-by: Christoph Lohmann <20h@r-36.net>
Diffstat (limited to 'st.c')
-rw-r--r--st.c385
1 files changed, 256 insertions, 129 deletions
diff --git a/st.c b/st.c
index b052b2b..03866f1 100644
--- a/st.c
+++ b/st.c
@@ -550,7 +550,8 @@ static Fontcache frc[16];
550static int frclen = 0; 550static int frclen = 0;
551 551
552ssize_t 552ssize_t
553xwrite(int fd, const char *s, size_t len) { 553xwrite(int fd, const char *s, size_t len)
554{
554 size_t aux = len; 555 size_t aux = len;
555 556
556 while(len > 0) { 557 while(len > 0) {
@@ -564,7 +565,8 @@ xwrite(int fd, const char *s, size_t len) {
564} 565}
565 566
566void * 567void *
567xmalloc(size_t len) { 568xmalloc(size_t len)
569{
568 void *p = malloc(len); 570 void *p = malloc(len);
569 571
570 if(!p) 572 if(!p)
@@ -574,7 +576,8 @@ xmalloc(size_t len) {
574} 576}
575 577
576void * 578void *
577xrealloc(void *p, size_t len) { 579xrealloc(void *p, size_t len)
580{
578 if((p = realloc(p, len)) == NULL) 581 if((p = realloc(p, len)) == NULL)
579 die("Out of memory\n"); 582 die("Out of memory\n");
580 583
@@ -582,7 +585,8 @@ xrealloc(void *p, size_t len) {
582} 585}
583 586
584char * 587char *
585xstrdup(char *s) { 588xstrdup(char *s)
589{
586 if((s = strdup(s)) == NULL) 590 if((s = strdup(s)) == NULL)
587 die("Out of memory\n"); 591 die("Out of memory\n");
588 592
@@ -590,7 +594,8 @@ xstrdup(char *s) {
590} 594}
591 595
592size_t 596size_t
593utf8decode(char *c, Rune *u, size_t clen) { 597utf8decode(char *c, Rune *u, size_t clen)
598{
594 size_t i, j, len, type; 599 size_t i, j, len, type;
595 Rune udecoded; 600 Rune udecoded;
596 601
@@ -613,7 +618,8 @@ utf8decode(char *c, Rune *u, size_t clen) {
613} 618}
614 619
615Rune 620Rune
616utf8decodebyte(char c, size_t *i) { 621utf8decodebyte(char c, size_t *i)
622{
617 for(*i = 0; *i < LEN(utfmask); ++(*i)) 623 for(*i = 0; *i < LEN(utfmask); ++(*i))
618 if(((uchar)c & utfmask[*i]) == utfbyte[*i]) 624 if(((uchar)c & utfmask[*i]) == utfbyte[*i])
619 return (uchar)c & ~utfmask[*i]; 625 return (uchar)c & ~utfmask[*i];
@@ -621,7 +627,8 @@ utf8decodebyte(char c, size_t *i) {
621} 627}
622 628
623size_t 629size_t
624utf8encode(Rune u, char *c) { 630utf8encode(Rune u, char *c)
631{
625 size_t len, i; 632 size_t len, i;
626 633
627 len = utf8validate(&u, 0); 634 len = utf8validate(&u, 0);
@@ -636,12 +643,14 @@ utf8encode(Rune u, char *c) {
636} 643}
637 644
638char 645char
639utf8encodebyte(Rune u, size_t i) { 646utf8encodebyte(Rune u, size_t i)
647{
640 return utfbyte[i] | (u & ~utfmask[i]); 648 return utfbyte[i] | (u & ~utfmask[i]);
641} 649}
642 650
643char * 651char *
644utf8strchr(char *s, Rune u) { 652utf8strchr(char *s, Rune u)
653{
645 Rune r; 654 Rune r;
646 size_t i, j, len; 655 size_t i, j, len;
647 656
@@ -656,7 +665,8 @@ utf8strchr(char *s, Rune u) {
656} 665}
657 666
658size_t 667size_t
659utf8validate(Rune *u, size_t i) { 668utf8validate(Rune *u, size_t i)
669{
660 if(!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) 670 if(!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
661 *u = UTF_INVALID; 671 *u = UTF_INVALID;
662 for(i = 1; *u > utfmax[i]; ++i) 672 for(i = 1; *u > utfmax[i]; ++i)
@@ -665,7 +675,8 @@ utf8validate(Rune *u, size_t i) {
665} 675}
666 676
667void 677void
668selinit(void) { 678selinit(void)
679{
669 memset(&sel.tclick1, 0, sizeof(sel.tclick1)); 680 memset(&sel.tclick1, 0, sizeof(sel.tclick1));
670 memset(&sel.tclick2, 0, sizeof(sel.tclick2)); 681 memset(&sel.tclick2, 0, sizeof(sel.tclick2));
671 sel.mode = SEL_IDLE; 682 sel.mode = SEL_IDLE;
@@ -678,7 +689,8 @@ selinit(void) {
678} 689}
679 690
680int 691int
681x2col(int x) { 692x2col(int x)
693{
682 x -= borderpx; 694 x -= borderpx;
683 x /= xw.cw; 695 x /= xw.cw;
684 696
@@ -686,7 +698,8 @@ x2col(int x) {
686} 698}
687 699
688int 700int
689y2row(int y) { 701y2row(int y)
702{
690 y -= borderpx; 703 y -= borderpx;
691 y /= xw.ch; 704 y /= xw.ch;
692 705
@@ -694,7 +707,8 @@ y2row(int y) {
694} 707}
695 708
696int 709int
697tlinelen(int y) { 710tlinelen(int y)
711{
698 int i = term.col; 712 int i = term.col;
699 713
700 if(term.line[y][i - 1].mode & ATTR_WRAP) 714 if(term.line[y][i - 1].mode & ATTR_WRAP)
@@ -707,7 +721,8 @@ tlinelen(int y) {
707} 721}
708 722
709void 723void
710selnormalize(void) { 724selnormalize(void)
725{
711 int i; 726 int i;
712 727
713 if(sel.type == SEL_REGULAR && sel.ob.y != sel.oe.y) { 728 if(sel.type == SEL_REGULAR && sel.ob.y != sel.oe.y) {
@@ -734,7 +749,8 @@ selnormalize(void) {
734} 749}
735 750
736int 751int
737selected(int x, int y) { 752selected(int x, int y)
753{
738 if(sel.mode == SEL_EMPTY) 754 if(sel.mode == SEL_EMPTY)
739 return 0; 755 return 0;
740 756
@@ -748,7 +764,8 @@ selected(int x, int y) {
748} 764}
749 765
750void 766void
751selsnap(int *x, int *y, int direction) { 767selsnap(int *x, int *y, int direction)
768{
752 int newx, newy, xt, yt; 769 int newx, newy, xt, yt;
753 int delim, prevdelim; 770 int delim, prevdelim;
754 Glyph *gp, *prevgp; 771 Glyph *gp, *prevgp;
@@ -820,7 +837,8 @@ selsnap(int *x, int *y, int direction) {
820} 837}
821 838
822void 839void
823getbuttoninfo(XEvent *e) { 840getbuttoninfo(XEvent *e)
841{
824 int type; 842 int type;
825 uint state = e->xbutton.state & ~(Button1Mask | forceselmod); 843 uint state = e->xbutton.state & ~(Button1Mask | forceselmod);
826 844
@@ -840,7 +858,8 @@ getbuttoninfo(XEvent *e) {
840} 858}
841 859
842void 860void
843mousereport(XEvent *e) { 861mousereport(XEvent *e)
862{
844 int x = x2col(e->xbutton.x), y = y2row(e->xbutton.y), 863 int x = x2col(e->xbutton.x), y = y2row(e->xbutton.y),
845 button = e->xbutton.button, state = e->xbutton.state, 864 button = e->xbutton.button, state = e->xbutton.state,
846 len; 865 len;
@@ -903,7 +922,8 @@ mousereport(XEvent *e) {
903} 922}
904 923
905void 924void
906bpress(XEvent *e) { 925bpress(XEvent *e)
926{
907 struct timespec now; 927 struct timespec now;
908 Mousekey *mk; 928 Mousekey *mk;
909 929
@@ -952,7 +972,8 @@ bpress(XEvent *e) {
952} 972}
953 973
954char * 974char *
955getsel(void) { 975getsel(void)
976{
956 char *str, *ptr; 977 char *str, *ptr;
957 int y, bufsize, lastx, linelen; 978 int y, bufsize, lastx, linelen;
958 Glyph *gp, *last; 979 Glyph *gp, *last;
@@ -1002,12 +1023,14 @@ getsel(void) {
1002} 1023}
1003 1024
1004void 1025void
1005selcopy(Time t) { 1026selcopy(Time t)
1027{
1006 xsetsel(getsel(), t); 1028 xsetsel(getsel(), t);
1007} 1029}
1008 1030
1009void 1031void
1010selnotify(XEvent *e) { 1032selnotify(XEvent *e)
1033{
1011 ulong nitems, ofs, rem; 1034 ulong nitems, ofs, rem;
1012 int format; 1035 int format;
1013 uchar *data, *last, *repl; 1036 uchar *data, *last, *repl;
@@ -1052,13 +1075,15 @@ selnotify(XEvent *e) {
1052} 1075}
1053 1076
1054void 1077void
1055selpaste(const Arg *dummy) { 1078selpaste(const Arg *dummy)
1079{
1056 XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, 1080 XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY,
1057 xw.win, CurrentTime); 1081 xw.win, CurrentTime);
1058} 1082}
1059 1083
1060void 1084void
1061clipcopy(const Arg *dummy) { 1085clipcopy(const Arg *dummy)
1086{
1062 Atom clipboard; 1087 Atom clipboard;
1063 1088
1064 if(sel.clipboard != NULL) 1089 if(sel.clipboard != NULL)
@@ -1072,7 +1097,8 @@ clipcopy(const Arg *dummy) {
1072} 1097}
1073 1098
1074void 1099void
1075clippaste(const Arg *dummy) { 1100clippaste(const Arg *dummy)
1101{
1076 Atom clipboard; 1102 Atom clipboard;
1077 1103
1078 clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0); 1104 clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
@@ -1081,7 +1107,8 @@ clippaste(const Arg *dummy) {
1081} 1107}
1082 1108
1083void 1109void
1084selclear(XEvent *e) { 1110selclear(XEvent *e)
1111{
1085 if(sel.ob.x == -1) 1112 if(sel.ob.x == -1)
1086 return; 1113 return;
1087 sel.mode = SEL_IDLE; 1114 sel.mode = SEL_IDLE;
@@ -1090,7 +1117,8 @@ selclear(XEvent *e) {
1090} 1117}
1091 1118
1092void 1119void
1093selrequest(XEvent *e) { 1120selrequest(XEvent *e)
1121{
1094 XSelectionRequestEvent *xsre; 1122 XSelectionRequestEvent *xsre;
1095 XSelectionEvent xev; 1123 XSelectionEvent xev;
1096 Atom xa_targets, string, clipboard; 1124 Atom xa_targets, string, clipboard;
@@ -1147,7 +1175,8 @@ selrequest(XEvent *e) {
1147} 1175}
1148 1176
1149void 1177void
1150xsetsel(char *str, Time t) { 1178xsetsel(char *str, Time t)
1179{
1151 free(sel.primary); 1180 free(sel.primary);
1152 sel.primary = str; 1181 sel.primary = str;
1153 1182
@@ -1157,7 +1186,8 @@ xsetsel(char *str, Time t) {
1157} 1186}
1158 1187
1159void 1188void
1160brelease(XEvent *e) { 1189brelease(XEvent *e)
1190{
1161 if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { 1191 if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
1162 mousereport(e); 1192 mousereport(e);
1163 return; 1193 return;
@@ -1177,7 +1207,8 @@ brelease(XEvent *e) {
1177} 1207}
1178 1208
1179void 1209void
1180bmotion(XEvent *e) { 1210bmotion(XEvent *e)
1211{
1181 int oldey, oldex, oldsby, oldsey; 1212 int oldey, oldex, oldsby, oldsey;
1182 1213
1183 if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { 1214 if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
@@ -1200,7 +1231,8 @@ bmotion(XEvent *e) {
1200} 1231}
1201 1232
1202void 1233void
1203die(const char *errstr, ...) { 1234die(const char *errstr, ...)
1235{
1204 va_list ap; 1236 va_list ap;
1205 1237
1206 va_start(ap, errstr); 1238 va_start(ap, errstr);
@@ -1210,7 +1242,8 @@ die(const char *errstr, ...) {
1210} 1242}
1211 1243
1212void 1244void
1213execsh(void) { 1245execsh(void)
1246{
1214 char **args, *sh, *prog; 1247 char **args, *sh, *prog;
1215 const struct passwd *pw; 1248 const struct passwd *pw;
1216 char buf[sizeof(long) * 8 + 1]; 1249 char buf[sizeof(long) * 8 + 1];
@@ -1259,7 +1292,8 @@ execsh(void) {
1259} 1292}
1260 1293
1261void 1294void
1262sigchld(int a) { 1295sigchld(int a)
1296{
1263 int stat; 1297 int stat;
1264 pid_t p; 1298 pid_t p;
1265 1299
@@ -1300,7 +1334,8 @@ stty(void)
1300} 1334}
1301 1335
1302void 1336void
1303ttynew(void) { 1337ttynew(void)
1338{
1304 int m, s; 1339 int m, s;
1305 struct winsize w = {term.row, term.col, 0, 0}; 1340 struct winsize w = {term.row, term.col, 0, 0};
1306 1341
@@ -1352,7 +1387,8 @@ ttynew(void) {
1352} 1387}
1353 1388
1354void 1389void
1355ttyread(void) { 1390ttyread(void)
1391{
1356 static char buf[BUFSIZ]; 1392 static char buf[BUFSIZ];
1357 static int buflen = 0; 1393 static int buflen = 0;
1358 char *ptr; 1394 char *ptr;
@@ -1378,13 +1414,15 @@ ttyread(void) {
1378} 1414}
1379 1415
1380void 1416void
1381ttywrite(const char *s, size_t n) { 1417ttywrite(const char *s, size_t n)
1418{
1382 if(xwrite(cmdfd, s, n) == -1) 1419 if(xwrite(cmdfd, s, n) == -1)
1383 die("write error on tty: %s\n", strerror(errno)); 1420 die("write error on tty: %s\n", strerror(errno));
1384} 1421}
1385 1422
1386void 1423void
1387ttysend(char *s, size_t n) { 1424ttysend(char *s, size_t n)
1425{
1388 int len; 1426 int len;
1389 Rune u; 1427 Rune u;
1390 1428
@@ -1398,7 +1436,8 @@ ttysend(char *s, size_t n) {
1398} 1436}
1399 1437
1400void 1438void
1401ttyresize(void) { 1439ttyresize(void)
1440{
1402 struct winsize w; 1441 struct winsize w;
1403 1442
1404 w.ws_row = term.row; 1443 w.ws_row = term.row;
@@ -1410,7 +1449,8 @@ ttyresize(void) {
1410} 1449}
1411 1450
1412int 1451int
1413tattrset(int attr) { 1452tattrset(int attr)
1453{
1414 int i, j; 1454 int i, j;
1415 1455
1416 for(i = 0; i < term.row-1; i++) { 1456 for(i = 0; i < term.row-1; i++) {
@@ -1424,7 +1464,8 @@ tattrset(int attr) {
1424} 1464}
1425 1465
1426void 1466void
1427tsetdirt(int top, int bot) { 1467tsetdirt(int top, int bot)
1468{
1428 int i; 1469 int i;
1429 1470
1430 LIMIT(top, 0, term.row-1); 1471 LIMIT(top, 0, term.row-1);
@@ -1435,7 +1476,8 @@ tsetdirt(int top, int bot) {
1435} 1476}
1436 1477
1437void 1478void
1438tsetdirtattr(int attr) { 1479tsetdirtattr(int attr)
1480{
1439 int i, j; 1481 int i, j;
1440 1482
1441 for(i = 0; i < term.row-1; i++) { 1483 for(i = 0; i < term.row-1; i++) {
@@ -1449,12 +1491,14 @@ tsetdirtattr(int attr) {
1449} 1491}
1450 1492
1451void 1493void
1452tfulldirt(void) { 1494tfulldirt(void)
1495{
1453 tsetdirt(0, term.row-1); 1496 tsetdirt(0, term.row-1);
1454} 1497}
1455 1498
1456void 1499void
1457tcursor(int mode) { 1500tcursor(int mode)
1501{
1458 static TCursor c[2]; 1502 static TCursor c[2];
1459 int alt = IS_SET(MODE_ALTSCREEN); 1503 int alt = IS_SET(MODE_ALTSCREEN);
1460 1504
@@ -1467,7 +1511,8 @@ tcursor(int mode) {
1467} 1511}
1468 1512
1469void 1513void
1470treset(void) { 1514treset(void)
1515{
1471 uint i; 1516 uint i;
1472 1517
1473 term.c = (TCursor){{ 1518 term.c = (TCursor){{
@@ -1494,7 +1539,8 @@ treset(void) {
1494} 1539}
1495 1540
1496void 1541void
1497tnew(int col, int row) { 1542tnew(int col, int row)
1543{
1498 term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } }; 1544 term = (Term){ .c = { .attr = { .fg = defaultfg, .bg = defaultbg } } };
1499 tresize(col, row); 1545 tresize(col, row);
1500 term.numlock = 1; 1546 term.numlock = 1;
@@ -1503,7 +1549,8 @@ tnew(int col, int row) {
1503} 1549}
1504 1550
1505void 1551void
1506tswapscreen(void) { 1552tswapscreen(void)
1553{
1507 Line *tmp = term.line; 1554 Line *tmp = term.line;
1508 1555
1509 term.line = term.alt; 1556 term.line = term.alt;
@@ -1513,7 +1560,8 @@ tswapscreen(void) {
1513} 1560}
1514 1561
1515void 1562void
1516tscrolldown(int orig, int n) { 1563tscrolldown(int orig, int n)
1564{
1517 int i; 1565 int i;
1518 Line temp; 1566 Line temp;
1519 1567
@@ -1532,7 +1580,8 @@ tscrolldown(int orig, int n) {
1532} 1580}
1533 1581
1534void 1582void
1535tscrollup(int orig, int n) { 1583tscrollup(int orig, int n)
1584{
1536 int i; 1585 int i;
1537 Line temp; 1586 Line temp;
1538 1587
@@ -1551,7 +1600,8 @@ tscrollup(int orig, int n) {
1551} 1600}
1552 1601
1553void 1602void
1554selscroll(int orig, int n) { 1603selscroll(int orig, int n)
1604{
1555 if(sel.ob.x == -1) 1605 if(sel.ob.x == -1)
1556 return; 1606 return;
1557 1607
@@ -1580,7 +1630,8 @@ selscroll(int orig, int n) {
1580} 1630}
1581 1631
1582void 1632void
1583tnewline(int first_col) { 1633tnewline(int first_col)
1634{
1584 int y = term.c.y; 1635 int y = term.c.y;
1585 1636
1586 if(y == term.bot) { 1637 if(y == term.bot) {
@@ -1592,7 +1643,8 @@ tnewline(int first_col) {
1592} 1643}
1593 1644
1594void 1645void
1595csiparse(void) { 1646csiparse(void)
1647{
1596 char *p = csiescseq.buf, *np; 1648 char *p = csiescseq.buf, *np;
1597 long int v; 1649 long int v;
1598 1650
@@ -1622,12 +1674,14 @@ csiparse(void) {
1622 1674
1623/* for absolute user moves, when decom is set */ 1675/* for absolute user moves, when decom is set */
1624void 1676void
1625tmoveato(int x, int y) { 1677tmoveato(int x, int y)
1678{
1626 tmoveto(x, y + ((term.c.state & CURSOR_ORIGIN) ? term.top: 0)); 1679 tmoveto(x, y + ((term.c.state & CURSOR_ORIGIN) ? term.top: 0));
1627} 1680}
1628 1681
1629void 1682void
1630tmoveto(int x, int y) { 1683tmoveto(int x, int y)
1684{
1631 int miny, maxy; 1685 int miny, maxy;
1632 1686
1633 if(term.c.state & CURSOR_ORIGIN) { 1687 if(term.c.state & CURSOR_ORIGIN) {
@@ -1643,7 +1697,8 @@ tmoveto(int x, int y) {
1643} 1697}
1644 1698
1645void 1699void
1646tsetchar(Rune u, Glyph *attr, int x, int y) { 1700tsetchar(Rune u, Glyph *attr, int x, int y)
1701{
1647 static char *vt100_0[62] = { /* 0x41 - 0x7e */ 1702 static char *vt100_0[62] = { /* 0x41 - 0x7e */
1648 "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */ 1703 "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */
1649 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ 1704 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
@@ -1678,7 +1733,8 @@ tsetchar(Rune u, Glyph *attr, int x, int y) {
1678} 1733}
1679 1734
1680void 1735void
1681tclearregion(int x1, int y1, int x2, int y2) { 1736tclearregion(int x1, int y1, int x2, int y2)
1737{
1682 int x, y, temp; 1738 int x, y, temp;
1683 Glyph *gp; 1739 Glyph *gp;
1684 1740
@@ -1707,7 +1763,8 @@ tclearregion(int x1, int y1, int x2, int y2) {
1707} 1763}
1708 1764
1709void 1765void
1710tdeletechar(int n) { 1766tdeletechar(int n)
1767{
1711 int dst, src, size; 1768 int dst, src, size;
1712 Glyph *line; 1769 Glyph *line;
1713 1770
@@ -1723,7 +1780,8 @@ tdeletechar(int n) {
1723} 1780}
1724 1781
1725void 1782void
1726tinsertblank(int n) { 1783tinsertblank(int n)
1784{
1727 int dst, src, size; 1785 int dst, src, size;
1728 Glyph *line; 1786 Glyph *line;
1729 1787
@@ -1739,19 +1797,22 @@ tinsertblank(int n) {
1739} 1797}
1740 1798
1741void 1799void
1742tinsertblankline(int n) { 1800tinsertblankline(int n)
1801{
1743 if(BETWEEN(term.c.y, term.top, term.bot)) 1802 if(BETWEEN(term.c.y, term.top, term.bot))
1744 tscrolldown(term.c.y, n); 1803 tscrolldown(term.c.y, n);
1745} 1804}
1746 1805
1747void 1806void
1748tdeleteline(int n) { 1807tdeleteline(int n)
1808{
1749 if(BETWEEN(term.c.y, term.top, term.bot)) 1809 if(BETWEEN(term.c.y, term.top, term.bot))
1750 tscrollup(term.c.y, n); 1810 tscrollup(term.c.y, n);
1751} 1811}
1752 1812
1753int32_t 1813int32_t
1754tdefcolor(int *attr, int *npar, int l) { 1814tdefcolor(int *attr, int *npar, int l)
1815{
1755 int32_t idx = -1; 1816 int32_t idx = -1;
1756 uint r, g, b; 1817 uint r, g, b;
1757 1818
@@ -1800,7 +1861,8 @@ tdefcolor(int *attr, int *npar, int l) {
1800} 1861}
1801 1862
1802void 1863void
1803tsetattr(int *attr, int l) { 1864tsetattr(int *attr, int l)
1865{
1804 int i; 1866 int i;
1805 int32_t idx; 1867 int32_t idx;
1806 1868
@@ -1900,7 +1962,8 @@ tsetattr(int *attr, int l) {
1900} 1962}
1901 1963
1902void 1964void
1903tsetscroll(int t, int b) { 1965tsetscroll(int t, int b)
1966{
1904 int temp; 1967 int temp;
1905 1968
1906 LIMIT(t, 0, term.row-1); 1969 LIMIT(t, 0, term.row-1);
@@ -1915,7 +1978,8 @@ tsetscroll(int t, int b) {
1915} 1978}
1916 1979
1917void 1980void
1918tsetmode(int priv, int set, int *args, int narg) { 1981tsetmode(int priv, int set, int *args, int narg)
1982{
1919 int *lim, mode; 1983 int *lim, mode;
1920 int alt; 1984 int alt;
1921 1985
@@ -2047,7 +2111,8 @@ tsetmode(int priv, int set, int *args, int narg) {
2047} 2111}
2048 2112
2049void 2113void
2050csihandle(void) { 2114csihandle(void)
2115{
2051 char buf[40]; 2116 char buf[40];
2052 int len; 2117 int len;
2053 2118
@@ -2256,7 +2321,8 @@ csihandle(void) {
2256} 2321}
2257 2322
2258void 2323void
2259csidump(void) { 2324csidump(void)
2325{
2260 int i; 2326 int i;
2261 uint c; 2327 uint c;
2262 2328
@@ -2279,12 +2345,14 @@ csidump(void) {
2279} 2345}
2280 2346
2281void 2347void
2282csireset(void) { 2348csireset(void)
2349{
2283 memset(&csiescseq, 0, sizeof(csiescseq)); 2350 memset(&csiescseq, 0, sizeof(csiescseq));
2284} 2351}
2285 2352
2286void 2353void
2287strhandle(void) { 2354strhandle(void)
2355{
2288 char *p = NULL; 2356 char *p = NULL;
2289 int j, narg, par; 2357 int j, narg, par;
2290 2358
@@ -2334,7 +2402,8 @@ strhandle(void) {
2334} 2402}
2335 2403
2336void 2404void
2337strparse(void) { 2405strparse(void)
2406{
2338 int c; 2407 int c;
2339 char *p = strescseq.buf; 2408 char *p = strescseq.buf;
2340 2409
@@ -2355,7 +2424,8 @@ strparse(void) {
2355} 2424}
2356 2425
2357void 2426void
2358strdump(void) { 2427strdump(void)
2428{
2359 int i; 2429 int i;
2360 uint c; 2430 uint c;
2361 2431
@@ -2380,12 +2450,14 @@ strdump(void) {
2380} 2450}
2381 2451
2382void 2452void
2383strreset(void) { 2453strreset(void)
2454{
2384 memset(&strescseq, 0, sizeof(strescseq)); 2455 memset(&strescseq, 0, sizeof(strescseq));
2385} 2456}
2386 2457
2387void 2458void
2388tprinter(char *s, size_t len) { 2459tprinter(char *s, size_t len)
2460{
2389 if(iofd != -1 && xwrite(iofd, s, len) < 0) { 2461 if(iofd != -1 && xwrite(iofd, s, len) < 0) {
2390 fprintf(stderr, "Error writing in %s:%s\n", 2462 fprintf(stderr, "Error writing in %s:%s\n",
2391 opt_io, strerror(errno)); 2463 opt_io, strerror(errno));
@@ -2395,22 +2467,26 @@ tprinter(char *s, size_t len) {
2395} 2467}
2396 2468
2397void 2469void
2398toggleprinter(const Arg *arg) { 2470toggleprinter(const Arg *arg)
2471{
2399 term.mode ^= MODE_PRINT; 2472 term.mode ^= MODE_PRINT;
2400} 2473}
2401 2474
2402void 2475void
2403printscreen(const Arg *arg) { 2476printscreen(const Arg *arg)
2477{
2404 tdump(); 2478 tdump();
2405} 2479}
2406 2480
2407void 2481void
2408printsel(const Arg *arg) { 2482printsel(const Arg *arg)
2483{
2409 tdumpsel(); 2484 tdumpsel();
2410} 2485}
2411 2486
2412void 2487void
2413tdumpsel(void) { 2488tdumpsel(void)
2489{
2414 char *ptr; 2490 char *ptr;
2415 2491
2416 if((ptr = getsel())) { 2492 if((ptr = getsel())) {
@@ -2420,7 +2496,8 @@ tdumpsel(void) {
2420} 2496}
2421 2497
2422void 2498void
2423tdumpline(int n) { 2499tdumpline(int n)
2500{
2424 char buf[UTF_SIZ]; 2501 char buf[UTF_SIZ];
2425 Glyph *bp, *end; 2502 Glyph *bp, *end;
2426 2503
@@ -2434,7 +2511,8 @@ tdumpline(int n) {
2434} 2511}
2435 2512
2436void 2513void
2437tdump(void) { 2514tdump(void)
2515{
2438 int i; 2516 int i;
2439 2517
2440 for(i = 0; i < term.row; ++i) 2518 for(i = 0; i < term.row; ++i)
@@ -2442,7 +2520,8 @@ tdump(void) {
2442} 2520}
2443 2521
2444void 2522void
2445tputtab(int n) { 2523tputtab(int n)
2524{
2446 uint x = term.c.x; 2525 uint x = term.c.x;
2447 2526
2448 if(n > 0) { 2527 if(n > 0) {
@@ -2458,7 +2537,8 @@ tputtab(int n) {
2458} 2537}
2459 2538
2460void 2539void
2461techo(Rune u) { 2540techo(Rune u)
2541{
2462 if(ISCONTROL(u)) { /* control code */ 2542 if(ISCONTROL(u)) { /* control code */
2463 if(u & 0x80) { 2543 if(u & 0x80) {
2464 u &= 0x7f; 2544 u &= 0x7f;
@@ -2473,7 +2553,8 @@ techo(Rune u) {
2473} 2553}
2474 2554
2475void 2555void
2476tdeftran(char ascii) { 2556tdeftran(char ascii)
2557{
2477 static char cs[] = "0B"; 2558 static char cs[] = "0B";
2478 static int vcs[] = {CS_GRAPHIC0, CS_USA}; 2559 static int vcs[] = {CS_GRAPHIC0, CS_USA};
2479 char *p; 2560 char *p;
@@ -2486,7 +2567,8 @@ tdeftran(char ascii) {
2486} 2567}
2487 2568
2488void 2569void
2489tdectest(char c) { 2570tdectest(char c)
2571{
2490 int x, y; 2572 int x, y;
2491 2573
2492 if(c == '8') { /* DEC screen alignment test. */ 2574 if(c == '8') { /* DEC screen alignment test. */
@@ -2498,7 +2580,8 @@ tdectest(char c) {
2498} 2580}
2499 2581
2500void 2582void
2501tstrsequence(uchar c) { 2583tstrsequence(uchar c)
2584{
2502 switch (c) { 2585 switch (c) {
2503 case 0x90: /* DCS -- Device Control String */ 2586 case 0x90: /* DCS -- Device Control String */
2504 c = 'P'; 2587 c = 'P';
@@ -2519,7 +2602,8 @@ tstrsequence(uchar c) {
2519} 2602}
2520 2603
2521void 2604void
2522tcontrolcode(uchar ascii) { 2605tcontrolcode(uchar ascii)
2606{
2523 switch(ascii) { 2607 switch(ascii) {
2524 case '\t': /* HT */ 2608 case '\t': /* HT */
2525 tputtab(1); 2609 tputtab(1);
@@ -2602,7 +2686,8 @@ tcontrolcode(uchar ascii) {
2602 * more characters for this sequence, otherwise 0 2686 * more characters for this sequence, otherwise 0
2603 */ 2687 */
2604int 2688int
2605eschandle(uchar ascii) { 2689eschandle(uchar ascii)
2690{
2606 switch(ascii) { 2691 switch(ascii) {
2607 case '[': 2692 case '[':
2608 term.esc |= ESC_CSI; 2693 term.esc |= ESC_CSI;
@@ -2681,7 +2766,8 @@ eschandle(uchar ascii) {
2681} 2766}
2682 2767
2683void 2768void
2684tputc(Rune u) { 2769tputc(Rune u)
2770{
2685 char c[UTF_SIZ]; 2771 char c[UTF_SIZ];
2686 int control; 2772 int control;
2687 int width, len; 2773 int width, len;
@@ -2803,7 +2889,8 @@ tputc(Rune u) {
2803} 2889}
2804 2890
2805void 2891void
2806tresize(int col, int row) { 2892tresize(int col, int row)
2893{
2807 int i; 2894 int i;
2808 int minrow = MIN(row, term.row); 2895 int minrow = MIN(row, term.row);
2809 int mincol = MIN(col, term.col); 2896 int mincol = MIN(col, term.col);
@@ -2887,7 +2974,8 @@ tresize(int col, int row) {
2887} 2974}
2888 2975
2889void 2976void
2890xresize(int col, int row) { 2977xresize(int col, int row)
2978{
2891 xw.tw = MAX(1, col * xw.cw); 2979 xw.tw = MAX(1, col * xw.cw);
2892 xw.th = MAX(1, row * xw.ch); 2980 xw.th = MAX(1, row * xw.ch);
2893 2981
@@ -2899,12 +2987,14 @@ xresize(int col, int row) {
2899} 2987}
2900 2988
2901ushort 2989ushort
2902sixd_to_16bit(int x) { 2990sixd_to_16bit(int x)
2991{
2903 return x == 0 ? 0 : 0x3737 + 0x2828 * x; 2992 return x == 0 ? 0 : 0x3737 + 0x2828 * x;
2904} 2993}
2905 2994
2906int 2995int
2907xloadcolor(int i, const char *name, Color *ncolor) { 2996xloadcolor(int i, const char *name, Color *ncolor)
2997{
2908 XRenderColor color = { .alpha = 0xffff }; 2998 XRenderColor color = { .alpha = 0xffff };
2909 2999
2910 if(!name) { 3000 if(!name) {
@@ -2926,7 +3016,8 @@ xloadcolor(int i, const char *name, Color *ncolor) {
2926} 3016}
2927 3017
2928void 3018void
2929xloadcols(void) { 3019xloadcols(void)
3020{
2930 int i; 3021 int i;
2931 static int loaded; 3022 static int loaded;
2932 Color *cp; 3023 Color *cp;
@@ -2947,7 +3038,8 @@ xloadcols(void) {
2947} 3038}
2948 3039
2949int 3040int
2950xsetcolorname(int x, const char *name) { 3041xsetcolorname(int x, const char *name)
3042{
2951 Color ncolor; 3043 Color ncolor;
2952 3044
2953 if(!BETWEEN(x, 0, LEN(dc.col))) 3045 if(!BETWEEN(x, 0, LEN(dc.col)))
@@ -2963,7 +3055,8 @@ xsetcolorname(int x, const char *name) {
2963} 3055}
2964 3056
2965void 3057void
2966xtermclear(int col1, int row1, int col2, int row2) { 3058xtermclear(int col1, int row1, int col2, int row2)
3059{
2967 XftDrawRect(xw.draw, 3060 XftDrawRect(xw.draw,
2968 &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg], 3061 &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
2969 borderpx + col1 * xw.cw, 3062 borderpx + col1 * xw.cw,
@@ -2976,14 +3069,16 @@ xtermclear(int col1, int row1, int col2, int row2) {
2976 * Absolute coordinates. 3069 * Absolute coordinates.
2977 */ 3070 */
2978void 3071void
2979xclear(int x1, int y1, int x2, int y2) { 3072xclear(int x1, int y1, int x2, int y2)
3073{
2980 XftDrawRect(xw.draw, 3074 XftDrawRect(xw.draw,
2981 &dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg], 3075 &dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg],
2982 x1, y1, x2-x1, y2-y1); 3076 x1, y1, x2-x1, y2-y1);
2983} 3077}
2984 3078
2985void 3079void
2986xhints(void) { 3080xhints(void)
3081{
2987 XClassHint class = {opt_class ? opt_class : termname, termname}; 3082 XClassHint class = {opt_class ? opt_class : termname, termname};
2988 XWMHints wm = {.flags = InputHint, .input = 1}; 3083 XWMHints wm = {.flags = InputHint, .input = 1};
2989 XSizeHints *sizeh = NULL; 3084 XSizeHints *sizeh = NULL;
@@ -3015,7 +3110,8 @@ xhints(void) {
3015} 3110}
3016 3111
3017int 3112int
3018xgeommasktogravity(int mask) { 3113xgeommasktogravity(int mask)
3114{
3019 switch(mask & (XNegative|YNegative)) { 3115 switch(mask & (XNegative|YNegative)) {
3020 case 0: 3116 case 0:
3021 return NorthWestGravity; 3117 return NorthWestGravity;
@@ -3028,7 +3124,8 @@ xgeommasktogravity(int mask) {
3028} 3124}
3029 3125
3030int 3126int
3031xloadfont(Font *f, FcPattern *pattern) { 3127xloadfont(Font *f, FcPattern *pattern)
3128{
3032 FcPattern *match; 3129 FcPattern *match;
3033 FcResult result; 3130 FcResult result;
3034 3131
@@ -3056,7 +3153,8 @@ xloadfont(Font *f, FcPattern *pattern) {
3056} 3153}
3057 3154
3058void 3155void
3059xloadfonts(char *fontstr, double fontsize) { 3156xloadfonts(char *fontstr, double fontsize)
3157{
3060 FcPattern *pattern; 3158 FcPattern *pattern;
3061 double fontval; 3159 double fontval;
3062 float ceilf(float); 3160 float ceilf(float);
@@ -3130,7 +3228,8 @@ xloadfonts(char *fontstr, double fontsize) {
3130} 3228}
3131 3229
3132void 3230void
3133xunloadfont(Font *f) { 3231xunloadfont(Font *f)
3232{
3134 XftFontClose(xw.dpy, f->match); 3233 XftFontClose(xw.dpy, f->match);
3135 FcPatternDestroy(f->pattern); 3234 FcPatternDestroy(f->pattern);
3136 if(f->set) 3235 if(f->set)
@@ -3138,7 +3237,8 @@ xunloadfont(Font *f) {
3138} 3237}
3139 3238
3140void 3239void
3141xunloadfonts(void) { 3240xunloadfonts(void)
3241{
3142 /* Free the loaded fonts in the font cache. */ 3242 /* Free the loaded fonts in the font cache. */
3143 while(frclen > 0) 3243 while(frclen > 0)
3144 XftFontClose(xw.dpy, frc[--frclen].font); 3244 XftFontClose(xw.dpy, frc[--frclen].font);
@@ -3150,7 +3250,8 @@ xunloadfonts(void) {
3150} 3250}
3151 3251
3152void 3252void
3153xzoom(const Arg *arg) { 3253xzoom(const Arg *arg)
3254{
3154 Arg larg; 3255 Arg larg;
3155 3256
3156 larg.f = usedfontsize + arg->f; 3257 larg.f = usedfontsize + arg->f;
@@ -3158,7 +3259,8 @@ xzoom(const Arg *arg) {
3158} 3259}
3159 3260
3160void 3261void
3161xzoomabs(const Arg *arg) { 3262xzoomabs(const Arg *arg)
3263{
3162 xunloadfonts(); 3264 xunloadfonts();
3163 xloadfonts(usedfont, arg->f); 3265 xloadfonts(usedfont, arg->f);
3164 cresize(0, 0); 3266 cresize(0, 0);
@@ -3167,7 +3269,8 @@ xzoomabs(const Arg *arg) {
3167} 3269}
3168 3270
3169void 3271void
3170xzoomreset(const Arg *arg) { 3272xzoomreset(const Arg *arg)
3273{
3171 Arg larg; 3274 Arg larg;
3172 3275
3173 if(defaultfontsize > 0) { 3276 if(defaultfontsize > 0) {
@@ -3177,7 +3280,8 @@ xzoomreset(const Arg *arg) {
3177} 3280}
3178 3281
3179void 3282void
3180xinit(void) { 3283xinit(void)
3284{
3181 XGCValues gcvalues; 3285 XGCValues gcvalues;
3182 Cursor cursor; 3286 Cursor cursor;
3183 Window parent; 3287 Window parent;
@@ -3408,7 +3512,8 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
3408} 3512}
3409 3513
3410void 3514void
3411xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y) { 3515xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, int y)
3516{
3412 int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1); 3517 int charlen = len * ((base.mode & ATTR_WIDE) ? 2 : 1);
3413 int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch, 3518 int winx = borderpx + x * xw.cw, winy = borderpx + y * xw.ch,
3414 width = charlen * xw.cw; 3519 width = charlen * xw.cw;
@@ -3541,7 +3646,8 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
3541} 3646}
3542 3647
3543void 3648void
3544xdrawglyph(Glyph g, int x, int y) { 3649xdrawglyph(Glyph g, int x, int y)
3650{
3545 int numspecs; 3651 int numspecs;
3546 XftGlyphFontSpec spec; 3652 XftGlyphFontSpec spec;
3547 numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y); 3653 numspecs = xmakeglyphfontspecs(&spec, &g, 1, x, y);
@@ -3549,7 +3655,8 @@ xdrawglyph(Glyph g, int x, int y) {
3549} 3655}
3550 3656
3551void 3657void
3552xdrawcursor(void) { 3658xdrawcursor(void)
3659{
3553 static int oldx = 0, oldy = 0; 3660 static int oldx = 0, oldy = 0;
3554 int curx; 3661 int curx;
3555 Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs}; 3662 Glyph g = {' ', ATTR_NULL, defaultbg, defaultcs};
@@ -3626,7 +3733,8 @@ xdrawcursor(void) {
3626 3733
3627 3734
3628void 3735void
3629xsettitle(char *p) { 3736xsettitle(char *p)
3737{
3630 XTextProperty prop; 3738 XTextProperty prop;
3631 3739
3632 Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, 3740 Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
@@ -3637,18 +3745,21 @@ xsettitle(char *p) {
3637} 3745}
3638 3746
3639void 3747void
3640xresettitle(void) { 3748xresettitle(void)
3749{
3641 xsettitle(opt_title ? opt_title : "st"); 3750 xsettitle(opt_title ? opt_title : "st");
3642} 3751}
3643 3752
3644void 3753void
3645redraw(void) { 3754redraw(void)
3755{
3646 tfulldirt(); 3756 tfulldirt();
3647 draw(); 3757 draw();
3648} 3758}
3649 3759
3650void 3760void
3651draw(void) { 3761draw(void)
3762{
3652 drawregion(0, 0, term.col, term.row); 3763 drawregion(0, 0, term.col, term.row);
3653 XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w, 3764 XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w,
3654 xw.h, 0, 0); 3765 xw.h, 0, 0);
@@ -3658,7 +3769,8 @@ draw(void) {
3658} 3769}
3659 3770
3660void 3771void
3661drawregion(int x1, int y1, int x2, int y2) { 3772drawregion(int x1, int y1, int x2, int y2)
3773{
3662 int i, x, y, ox, numspecs; 3774 int i, x, y, ox, numspecs;
3663 Glyph base, new; 3775 Glyph base, new;
3664 XftGlyphFontSpec* specs; 3776 XftGlyphFontSpec* specs;
@@ -3703,30 +3815,35 @@ drawregion(int x1, int y1, int x2, int y2) {
3703} 3815}
3704 3816
3705void 3817void
3706expose(XEvent *ev) { 3818expose(XEvent *ev)
3819{
3707 redraw(); 3820 redraw();
3708} 3821}
3709 3822
3710void 3823void
3711visibility(XEvent *ev) { 3824visibility(XEvent *ev)
3825{
3712 XVisibilityEvent *e = &ev->xvisibility; 3826 XVisibilityEvent *e = &ev->xvisibility;
3713 3827
3714 MODBIT(xw.state, e->state != VisibilityFullyObscured, WIN_VISIBLE); 3828 MODBIT(xw.state, e->state != VisibilityFullyObscured, WIN_VISIBLE);
3715} 3829}
3716 3830
3717void 3831void
3718unmap(XEvent *ev) { 3832unmap(XEvent *ev)
3833{
3719 xw.state &= ~WIN_VISIBLE; 3834 xw.state &= ~WIN_VISIBLE;
3720} 3835}
3721 3836
3722void 3837void
3723xsetpointermotion(int set) { 3838xsetpointermotion(int set)
3839{
3724 MODBIT(xw.attrs.event_mask, set, PointerMotionMask); 3840 MODBIT(xw.attrs.event_mask, set, PointerMotionMask);
3725 XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); 3841 XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs);
3726} 3842}
3727 3843
3728void 3844void
3729xseturgency(int add) { 3845xseturgency(int add)
3846{
3730 XWMHints *h = XGetWMHints(xw.dpy, xw.win); 3847 XWMHints *h = XGetWMHints(xw.dpy, xw.win);
3731 3848
3732 MODBIT(h->flags, add, XUrgencyHint); 3849 MODBIT(h->flags, add, XUrgencyHint);
@@ -3735,7 +3852,8 @@ xseturgency(int add) {
3735} 3852}
3736 3853
3737void 3854void
3738focus(XEvent *ev) { 3855focus(XEvent *ev)
3856{
3739 XFocusChangeEvent *e = &ev->xfocus; 3857 XFocusChangeEvent *e = &ev->xfocus;
3740 3858
3741 if(e->mode == NotifyGrab) 3859 if(e->mode == NotifyGrab)
@@ -3756,17 +3874,20 @@ focus(XEvent *ev) {
3756} 3874}
3757 3875
3758int 3876int
3759match(uint mask, uint state) { 3877match(uint mask, uint state)
3878{
3760 return mask == XK_ANY_MOD || mask == (state & ~ignoremod); 3879 return mask == XK_ANY_MOD || mask == (state & ~ignoremod);
3761} 3880}
3762 3881
3763void 3882void
3764numlock(const Arg *dummy) { 3883numlock(const Arg *dummy)
3884{
3765 term.numlock ^= 1; 3885 term.numlock ^= 1;
3766} 3886}
3767 3887
3768char* 3888char*
3769kmap(KeySym k, uint state) { 3889kmap(KeySym k, uint state)
3890{
3770 Key *kp; 3891 Key *kp;
3771 int i; 3892 int i;
3772 3893
@@ -3805,7 +3926,8 @@ kmap(KeySym k, uint state) {
3805} 3926}
3806 3927
3807void 3928void
3808kpress(XEvent *ev) { 3929kpress(XEvent *ev)
3930{
3809 XKeyEvent *e = &ev->xkey; 3931 XKeyEvent *e = &ev->xkey;
3810 KeySym ksym; 3932 KeySym ksym;
3811 char buf[32], *customkey; 3933 char buf[32], *customkey;
@@ -3852,7 +3974,8 @@ kpress(XEvent *ev) {
3852 3974
3853 3975
3854void 3976void
3855cmessage(XEvent *e) { 3977cmessage(XEvent *e)
3978{
3856 /* 3979 /*
3857 * See xembed specs 3980 * See xembed specs
3858 * http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html 3981 * http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
@@ -3872,7 +3995,8 @@ cmessage(XEvent *e) {
3872} 3995}
3873 3996
3874void 3997void
3875cresize(int width, int height) { 3998cresize(int width, int height)
3999{
3876 int col, row; 4000 int col, row;
3877 4001
3878 if(width != 0) 4002 if(width != 0)
@@ -3889,7 +4013,8 @@ cresize(int width, int height) {
3889} 4013}
3890 4014
3891void 4015void
3892resize(XEvent *e) { 4016resize(XEvent *e)
4017{
3893 if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h) 4018 if(e->xconfigure.width == xw.w && e->xconfigure.height == xw.h)
3894 return; 4019 return;
3895 4020
@@ -3897,7 +4022,8 @@ resize(XEvent *e) {
3897} 4022}
3898 4023
3899void 4024void
3900run(void) { 4025run(void)
4026{
3901 XEvent ev; 4027 XEvent ev;
3902 int w = xw.w, h = xw.h; 4028 int w = xw.w, h = xw.h;
3903 fd_set rfd; 4029 fd_set rfd;
@@ -4004,7 +4130,8 @@ run(void) {
4004} 4130}
4005 4131
4006void 4132void
4007usage(void) { 4133usage(void)
4134{
4008 die("%s " VERSION " (c) 2010-2015 st engineers\n" 4135 die("%s " VERSION " (c) 2010-2015 st engineers\n"
4009 "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]\n" 4136 "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]\n"
4010 " [-i] [-t title] [-w windowid] [-e command ...] [command ...]\n" 4137 " [-i] [-t title] [-w windowid] [-e command ...] [command ...]\n"
@@ -4014,7 +4141,8 @@ usage(void) {
4014} 4141}
4015 4142
4016int 4143int
4017main(int argc, char *argv[]) { 4144main(int argc, char *argv[])
4145{
4018 uint cols = 80, rows = 24; 4146 uint cols = 80, rows = 24;
4019 4147
4020 xw.l = xw.t = 0; 4148 xw.l = xw.t = 0;
@@ -4075,4 +4203,3 @@ run:
4075 4203
4076 return 0; 4204 return 0;
4077} 4205}
4078