mirror of
https://github.com/paxed/dgamelaunch.git
synced 2025-07-31 01:24:43 +02:00
Abort if window size too small
Force window size to 80x24 (if the watched game's window size is larger than the watcher's, chaos results) git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@247 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
44c608a12f
commit
89181d3dcd
@ -219,22 +219,23 @@ create_config ()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ttyrec_getmaster ()
|
ttyrec_getpty ()
|
||||||
{
|
{
|
||||||
(void) tcgetattr (0, &tt);
|
|
||||||
if (-1 == ioctl (0, TIOCGWINSZ, (char *) &win))
|
|
||||||
{
|
|
||||||
win.ws_row = 24;
|
|
||||||
win.ws_col = 80;
|
|
||||||
win.ws_xpixel = win.ws_col * 8;
|
|
||||||
win.ws_ypixel = win.ws_row * 8;
|
|
||||||
}
|
|
||||||
#ifdef USE_OPENPTY
|
#ifdef USE_OPENPTY
|
||||||
if (openpty (&master, &slave, NULL, &tt, &win) == -1)
|
if (openpty (&master, &slave, NULL, NULL, NULL) == -1)
|
||||||
|
graceful_exit (62);
|
||||||
#else
|
#else
|
||||||
if ((master = open ("/dev/ptmx", O_RDWR)) < 0)
|
if ((master = open ("/dev/ptmx", O_RDWR)) < 0)
|
||||||
#endif
|
|
||||||
graceful_exit (62);
|
graceful_exit (62);
|
||||||
|
grantpt (master);
|
||||||
|
unlockpt (master);
|
||||||
|
if ((slave = open ((const char *) ptsname (master), O_RDWR)) < 0)
|
||||||
|
{
|
||||||
|
graceful_exit (65);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ioctl (slave, TIOCSWINSZ, (char *) &win);
|
||||||
|
tcsetattr(slave, TCSANOW, &tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
@ -1613,17 +1614,22 @@ main (int argc, char** argv)
|
|||||||
/* signal handlers */
|
/* signal handlers */
|
||||||
signal (SIGHUP, catch_sighup);
|
signal (SIGHUP, catch_sighup);
|
||||||
|
|
||||||
/* get master tty just before chroot (lives in /dev) */
|
(void) tcgetattr (0, &tt);
|
||||||
ttyrec_getmaster ();
|
if (ioctl (0, TIOCGWINSZ, (char *) &win) == 0)
|
||||||
#ifndef USE_OPENPTY
|
|
||||||
grantpt (master);
|
|
||||||
unlockpt (master);
|
|
||||||
if ((slave = open ((const char *) ptsname (master), O_RDWR)) < 0)
|
|
||||||
{
|
{
|
||||||
graceful_exit (65);
|
if (win.ws_row < 24 || win.ws_col < 80)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: dgamelaunch needs at least 80x24 screen.\n");
|
||||||
|
graceful_exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
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 ();
|
||||||
|
|
||||||
/* chroot */
|
/* chroot */
|
||||||
if (chroot (myconfig->chroot))
|
if (chroot (myconfig->chroot))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user