[MPlayer-dev-eng] [PATCH] console width detection for status line

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Nov 9 20:42:16 CET 2004


Hi,
my status line patch used directly the TIOCGWINSZ ioctl, but I saw that
the same code is already in getch2, in the get_screen_size function.
Although I dislike that it modifies global variables this patch makes it
use that function, both to avoid code duplication and improve
portability (actually it also fixes bug #131).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.807
diff -u -r1.807 mplayer.c
--- mplayer.c	5 Nov 2004 21:44:20 -0000	1.807
+++ mplayer.c	7 Nov 2004 20:32:47 -0000
@@ -815,12 +815,10 @@
   int width;
   char *line;
   unsigned pos = 0;
-#ifndef __MINGW32__
-  struct winsize ws;
-  if (ioctl(0, TIOCGWINSZ, &ws) != -1 && ws.ws_col)
-    width = ws.ws_col;
+  get_screen_size();
+  if (screen_width > 0)
+    width = screen_width;
   else
-#endif
   width = 80;
   line = malloc(width + 1); // one additional for terminating null
   


More information about the MPlayer-dev-eng mailing list