Skip to content

Instantly share code, notes, and snippets.

@saitoha
Created July 15, 2015 15:09
Show Gist options
  • Save saitoha/2c662697f972170150ab to your computer and use it in GitHub Desktop.
Save saitoha/2c662697f972170150ab to your computer and use it in GitHub Desktop.
yaft: rreturn pixel size over TIOCGWINSZ
diff --git a/x/yaftx.c b/x/yaftx.c
index 891450d..6c63562 100644
--- a/x/yaftx.c
+++ b/x/yaftx.c
@@ -104,7 +104,8 @@ void xresize(struct xwindow *xw, struct terminal *term, XEvent *ev)
ws.ws_col = term->cols;
ws.ws_row = term->lines;
- ws.ws_xpixel = ws.ws_ypixel = 0;
+ ws.ws_ypixel = CELL_HEIGHT * term->lines;
+ ws.ws_xpixel = CELL_WIDTH * term->cols;
ioctl(term->fd, TIOCSWINSZ, &ws);
}
diff --git a/yaft.c b/yaft.c
index 6068da2..346a084 100644
--- a/yaft.c
+++ b/yaft.c
@@ -113,7 +113,7 @@ void fork_and_exec(int *master, int lines, int cols)
char *shell_env;
pid_t pid;
struct winsize ws = {.ws_row = lines, .ws_col = cols,
- .ws_xpixel = 0, .ws_ypixel = 0};
+ .ws_xpixel = CELL_HEIGHT * lines, .ws_ypixel = CELL_WIDTH * width};
pid = eforkpty(master, NULL, NULL, &ws);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment