diff --git a/configure.ac b/configure.ac index 28c15210..026af7c4 100644 --- a/configure.ac +++ b/configure.ac @@ -52,7 +52,7 @@ AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([off_t]) # Check headers/libs -AC_CHECK_HEADERS([sys/select.h sys/time.h pty.h util.h termios.h]) +AC_CHECK_HEADERS([sys/select.h sys/time.h sys/ioctl.h pty.h util.h termios.h]) AC_CHECK_LIB([network],[socket]) AC_CHECK_LIB([util],[forkpty]) diff --git a/src/internal.c b/src/internal.c index 1c42618b..85850e24 100644 --- a/src/internal.c +++ b/src/internal.c @@ -13069,20 +13069,21 @@ int SendChannelTerminalResize(WOLFSSH* ssh, word32 columns, word32 rows, } -#ifdef __linux__ -#ifdef HAVE_PTY_H - #include -#endif +#ifdef HAVE_SYS_IOCTL_H + #include #endif -static void GetTerminalSize(word32* width, word32* height) +static void GetTerminalSize(word32* width, word32* height, + word32* pixWidth, word32* pixHeight) { -#ifdef __linux__ +#ifdef HAVE_SYS_IOCTL_H struct winsize windowSize = { 0,0,0,0 }; ioctl(STDOUT_FILENO, TIOCGWINSZ, &windowSize); *width = (word32)windowSize.ws_col; *height = (word32)windowSize.ws_row; + *pixWidth = (word32)windowSize.ws_xpixel; + *pixHeight = (word32)windowSize.ws_ypixel; #elif defined(_MSC_VER) CONSOLE_SCREEN_BUFFER_INFO cs; @@ -13110,15 +13111,14 @@ int SendChannelTerminalRequest(WOLFSSH* ssh) const char envVar[] = "xterm"; byte mode[4096]; word32 envSz, typeSz, modeSz; - word32 w, h; - word32 pxW = 0, pxH = 0; + word32 w = 0, h = 0, pxW = 0, pxH = 0; WLOG(WS_LOG_DEBUG, "Entering SendChannelTerminalRequest()"); if (ssh == NULL) ret = WS_BAD_ARGUMENT; - GetTerminalSize(&w, &h); + GetTerminalSize(&w, &h, &pxW, &pxH); envSz = (word32)WSTRLEN(envVar); typeSz = (word32)WSTRLEN(cType); modeSz = CreateMode(ssh, mode);