1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 12:17:12 +00:00

video/out/vo_tct: query terminal size generically

terminal_get_size also works on windows. This is useful because now
tct also works on Windows with native VT console.
This commit is contained in:
Avi Halachmi (:avih) 2020-04-23 19:41:44 +03:00 committed by Jan Ekström
parent b5b266c38c
commit b036e56e67

View File

@ -27,6 +27,7 @@
#include "options/m_config.h"
#include "config.h"
#include "osdep/terminal.h"
#include "vo.h"
#include "sub/osd.h"
#include "video/sws_utils.h"
@ -179,13 +180,8 @@ static void get_win_size(struct vo *vo, int *out_width, int *out_height) {
struct priv *p = vo->priv;
*out_width = DEFAULT_WIDTH;
*out_height = DEFAULT_HEIGHT;
#if HAVE_POSIX
struct winsize winsize;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) >= 0) {
*out_width = winsize.ws_col;
*out_height = winsize.ws_row;
}
#endif
terminal_get_size(out_width, out_height);
if (p->opts->width > 0)
*out_width = p->opts->width;