X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=75c191de8c5dffc99acc99394a3e38400323c15b;hb=a8314643b1aeaa2187dad71dc5748aaac1760c1b;hp=ae93ade5e83c56f24af82e6e7fa771b22e8bd16a;hpb=8dacdfbab1c476063a31bc3b8d7222ac2b70ff66;p=st.git diff --git a/st.c b/st.c index ae93ade..75c191d 100644 --- a/st.c +++ b/st.c @@ -28,13 +28,8 @@ #include #include -char *argv0; - -#define Glyph Glyph_ -#define Font Font_ - -#include "win.h" #include "st.h" +#include "win.h" #if defined(__linux) #include @@ -60,7 +55,7 @@ char *argv0; #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) /* constants */ -#define ISO14755CMD "dmenu -w %lu -p codepoint: > 4); if (c == -1) @@ -425,24 +418,6 @@ selinit(void) sel.clipboard = NULL; } -int -x2col(int x) -{ - x -= borderpx; - x /= win.cw; - - return LIMIT(x, 0, term.col-1); -} - -int -y2row(int y) -{ - y -= borderpx; - y /= win.ch; - - return LIMIT(y, 0, term.row-1); -} - int tlinelen(int y) { @@ -699,7 +674,6 @@ execsh(void) setenv("SHELL", sh, 1); setenv("HOME", pw->pw_dir, 1); setenv("TERM", termname, 1); - xsetenv(); signal(SIGCHLD, SIG_DFL); signal(SIGHUP, SIG_DFL); @@ -1986,14 +1960,11 @@ 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"))) + if (!(p = popen(ISO14755CMD, "r"))) return; us = fgets(codepoint, sizeof(codepoint), p); @@ -2178,10 +2149,7 @@ tcontrolcode(uchar ascii) /* backwards compatibility to xterm */ strhandle(); } else { - if (!(win.state & WIN_FOCUSED)) - xseturgency(1); - if (bellvolume) - xbell(bellvolume); + xbell(); } break; case '\033': /* ESC */ @@ -2521,9 +2489,6 @@ tresize(int col, int row) free(term.alt[i]); } - /* resize to new width */ - term.specbuf = xrealloc(term.specbuf, col * sizeof(GlyphFontSpec)); - /* resize to new height */ term.line = xrealloc(term.line, row * sizeof(Line)); term.alt = xrealloc(term.alt, row * sizeof(Line)); @@ -2572,37 +2537,6 @@ tresize(int col, int row) term.c = c; } -void -zoom(const Arg *arg) -{ - Arg larg; - - larg.f = usedfontsize + arg->f; - zoomabs(&larg); -} - -void -zoomabs(const Arg *arg) -{ - xunloadfonts(); - xloadfonts(usedfont, arg->f); - cresize(0, 0); - ttyresize(); - redraw(); - xhints(); -} - -void -zoomreset(const Arg *arg) -{ - Arg larg; - - if (defaultfontsize > 0) { - larg.f = defaultfontsize; - zoomabs(&larg); - } -} - void resettitle(void) { @@ -2667,33 +2601,3 @@ kmap(KeySym k, uint state) return NULL; } - -void -cresize(int width, int height) -{ - int col, row; - - if (width != 0) - win.w = width; - if (height != 0) - win.h = height; - - col = (win.w - 2 * borderpx) / win.cw; - row = (win.h - 2 * borderpx) / win.ch; - - tresize(col, row); - xresize(col, row); -} - -void -usage(void) -{ - die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]" - " [-n name] [-o file]\n" - " [-T title] [-t title] [-w windowid]" - " [[-e] command [args ...]]\n" - " %s [-aiv] [-c class] [-f font] [-g geometry]" - " [-n name] [-o file]\n" - " [-T title] [-t title] [-w windowid] -l line" - " [stty_args ...]\n", argv0, argv0); -}