]> skyeroc.xyz Git - dgamelaunch/commitdiff
Use client-supplied window size again (Pasi Kallinen).
authorJilles Tjoelker <jilles@stack.nl>
Thu, 4 Mar 2004 13:30:12 +0000 (13:30 +0000)
committerJilles Tjoelker <jilles@stack.nl>
Thu, 4 Mar 2004 13:30:12 +0000 (13:30 +0000)
Try to detect broken clients and force them to 80x24.
This backs out the functional change in rev 247.
Passing through window size to watchers in a later commit.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@264 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 489db192fd406d094923b4a2cd232d84519077a6..c7be452059de9c3f779cdf31bba8371ffce30aea 100644 (file)
@@ -1413,10 +1413,14 @@ main (int argc, char** argv)
   signal (SIGHUP, catch_sighup);
 
   (void) tcgetattr (0, &tt);
-  win.ws_row = 24;
-  win.ws_col = 80;
-  win.ws_xpixel = win.ws_col * 8;
-  win.ws_ypixel = win.ws_row * 8;
+  if (-1 == ioctl (0, TIOCGWINSZ, (char *) &win) || win.ws_row < 4 ||
+                 win.ws_col < 4) /* Rudimentary validity check */
+    {
+      win.ws_row = 24;
+      win.ws_col = 80;
+      win.ws_xpixel = win.ws_col * 8;
+      win.ws_ypixel = win.ws_row * 8;
+    }
 
   /* get master tty just before chroot (lives in /dev) */
   ttyrec_getpty ();