openbsd-ports/audio/ncmpc/patches/patch-src_screen_c
2010-08-31 20:50:33 +00:00

35 lines
802 B
Plaintext

$OpenBSD: patch-src_screen_c,v 1.3 2010/08/31 20:50:33 jasper Exp $
--- src/screen.c.orig Thu Jul 15 04:01:30 2010
+++ src/screen.c Tue Aug 31 22:49:26 2010
@@ -40,6 +40,8 @@
#include "screen_lyrics.h"
#include "screen_outputs.h"
+#include <sys/ioctl.h>
+
#include <mpd/client.h>
#include <stdlib.h>
@@ -47,6 +49,7 @@
#include <string.h>
#include <time.h>
#include <locale.h>
+#include <termios.h>
#ifndef NCMPC_MINI
/** welcome message time [s] */
@@ -200,6 +203,13 @@ screen_exit(void)
void
screen_resize(struct mpdclient *c)
{
+ struct winsize ws;
+
+ if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) == 0) {
+ LINES = ws.ws_row;
+ COLS = ws.ws_col;
+ }
+
if (COLS<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS) {
screen_exit();
fprintf(stderr, "%s", _("Error: Screen too small"));