Просмотр исходного кода

* Support CACA_GEOMETRY in the network driver. Still defaults to 80x24.

* Use RETSIGTYPE for signal handler return values.
tags/v0.99.beta14
Sam Hocevar sam 18 лет назад
Родитель
Сommit
195da3f08f
2 измененных файлов: 22 добавлений и 8 удалений
  1. +1
    -1
      caca/caca.h
  2. +21
    -7
      caca/driver_network.c

+ 1
- 1
caca/caca.h Просмотреть файл

@@ -87,7 +87,7 @@
*
* \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 and the GL driver.
* currently works with the network, X11 and GL drivers.
*
* \li \b CACA_FONT: set the rendered font. The format of this variable is
* implementation dependent, but since it currently only works with the


+ 21
- 7
caca/driver_network.c Просмотреть файл

@@ -90,7 +90,7 @@ struct driver_private
int client_count;
struct client *clients;

void (*sigpipe_handler)(int);
RETSIGTYPE (*sigpipe_handler)(int);
};

static void manage_connections(caca_t *kk);
@@ -101,24 +101,38 @@ static int network_init_graphics(caca_t *kk)
{
int yes = 1, flags;
int port = 0xCACA; /* 51914 */
char *network_port, *tmp;
unsigned int width = 0, height = 0;
char *tmp;

kk->drv.p = malloc(sizeof(struct driver_private));
if(kk->drv.p == NULL)
return -1;

#if defined(HAVE_GETENV)
network_port = getenv("CACA_PORT");
if(network_port && *network_port)
tmp = getenv("CACA_PORT");
if(tmp && *tmp)
{
int new_port = atoi(network_port);
int new_port = atoi(tmp);
if(new_port)
port = new_port;
}

tmp = getenv("CACA_GEOMETRY");
if(tmp && *tmp)
sscanf(tmp, "%ux%u", &width, &height);
#endif

kk->drv.p->width = 80;
kk->drv.p->height = 24;
if(width && height)
{
kk->drv.p->width = width;
kk->drv.p->height = height;
}
else
{
kk->drv.p->width = 80;
kk->drv.p->height = 24;
}

kk->drv.p->client_count = 0;
kk->drv.p->clients = NULL;
kk->drv.p->port = port;


Загрузка…
Отмена
Сохранить