From 854d5bf982d146f16d24c98ab0ccf3d46bfd9491 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 24 Dec 2003 15:43:45 +0000 Subject: [PATCH] * src/graphics.c: + Replace CACA_WIDTH and CACA_HEIGHT with CACA_GEOMETRY. * src/caca.c: + Documented the CACA_GEOMETRY environment variable. --- NEWS | 3 +-- src/caca.h | 4 ++++ src/graphics.c | 9 ++++----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 2ad108f..2e9941e 100644 --- a/NEWS +++ b/NEWS @@ -5,8 +5,7 @@ Changes between 0.3 and 0.4: * preliminary X11 graphics driver * support for simultaneously compiled-in drivers - * honour the CACA_DRIVER, CACA_WIDTH, CACA_HEIGHT and CACA_FONT environment - variables + * honour the CACA_DRIVER, CACA_GEOMETRY and CACA_FONT environment variables * more documentation Changes between 0.2 and 0.3: diff --git a/src/caca.h b/src/caca.h index 7be2392..245d53f 100644 --- a/src/caca.h +++ b/src/caca.h @@ -62,6 +62,10 @@ * - \c slang uses the S-Lang library. * - \c x11 uses the native X11 driver. * + * \li \b CACA_GEOMETRY: set the video display size. The format of this + * variable must be XxY, with X and Y being integer values. This option + * currently only works with the X11 driver. + * * \li \b CACA_BACKGROUND: set the background type. * - \c solid uses solid coloured backgrounds for all characters. This * feature does not work with all terminal emulators. This is the diff --git a/src/graphics.c b/src/graphics.c index 132d3e9..4996026 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -520,13 +520,12 @@ int _caca_init_graphics(void) const char *font_name = "8x13bold"; int i; - if(getenv("CACA_WIDTH")) - _caca_width = atoi(getenv("CACA_WIDTH")); + if(getenv("CACA_GEOMETRY")) + sscanf(getenv("CACA_GEOMETRY"), + "%ux%u", &_caca_width, &_caca_height); + if(!_caca_width) _caca_width = 80; - - if(getenv("CACA_HEIGHT")) - _caca_height = atoi(getenv("CACA_HEIGHT")); if(!_caca_height) _caca_height = 32;