Changeset 1233


Ignore:
Timestamp:
Oct 26, 2006, 10:16:43 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Allow to create the initial canvas with a zero size. Either the application resizes it later, or the driver changes it to fit the display.
Location:
libcaca/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_gl.c

    r1218 r1233  
    8787    char *argv[2] = { "", NULL };
    8888    char const * const * fonts;
    89     unsigned int width = 0, height = 0;
     89    unsigned int width = dp->cv->width, height = dp->cv->height;
    9090    int argc = 1;
    9191
     
    100100#endif
    101101
    102     if(width && height)
    103         _cucul_set_canvas_size(dp->cv, width, height);
    104 
     102    _cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32);
    105103
    106104    /* Load a libcucul internal font */
  • libcaca/trunk/caca/driver_raw.c

    r1054 r1233  
    2222
    2323#include <stdio.h>
     24#include <stdlib.h>
    2425
    2526#include "caca.h"
     
    3031static int raw_init_graphics(caca_display_t *dp)
    3132{
     33    unsigned int width = dp->cv->width, height = dp->cv->height;
     34    char const *geometry;
     35
     36#if defined(HAVE_GETENV)
     37    geometry = getenv("CACA_GEOMETRY");
     38    if(geometry && *geometry)
     39        sscanf(geometry, "%ux%u", &width, &height);
     40#endif
     41
     42    _cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 24);
     43
    3244    return 0;
    3345}
  • libcaca/trunk/caca/driver_win32.c

    r1218 r1233  
    113113
    114114    /* Set the new console size */
    115     size.X = dp->cv->width;
    116     size.Y = dp->cv->height;
     115    size.X = dp->cv->width ? dp->cv->width : 80;
     116    size.Y = dp->cv->height ? dp->cv->height : 25;
    117117    SetConsoleScreenBufferSize(dp->drv.p->screen, size);
    118118
  • libcaca/trunk/caca/driver_x11.c

    r1218 r1233  
    6868    char const *fonts[] = { NULL, "8x13bold", "fixed" }, **parser;
    6969    char const *geometry;
    70     unsigned int width = 0, height = 0;
     70    unsigned int width = dp->cv->width, height = dp->cv->height;
    7171    int i;
    7272
     
    7979#endif
    8080
    81     if(width && height)
    82         _cucul_set_canvas_size(dp->cv, width, height);
     81    _cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32);
    8382
    8483    dp->drv.p->dpy = XOpenDisplay(NULL);
  • libcaca/trunk/cucul/cucul.c

    r1231 r1233  
    4444 *  should be called at the end of the program to free all allocated resources.
    4545 *
    46  *  If one of the desired canvas coordinates is zero, a default canvas size
    47  *  of 80x32 is used instead.
    48  *
    4946 *  If an error occurs, NULL is returned and \b errno is set accordingly:
    5047 *  - \c ENOMEM Not enough memory for the requested canvas size.
     
    5754{
    5855    cucul_canvas_t *cv = malloc(sizeof(cucul_canvas_t));
    59     int ret;
    6056
    6157    if(!cv)
     
    8985    cv->allattr[0] = NULL;
    9086
    91     /* Initialise to a default size. 80x32 is arbitrary but matches AAlib's
    92      * default X11 window. When a graphic driver attaches to us, it can set
    93      * a different size. */
    94     if(width && height)
    95         ret = _cucul_set_canvas_size(cv, width, height);
    96     else
    97         ret = _cucul_set_canvas_size(cv, 80, 32);
    98 
    99     if(ret < 0)
     87    if(_cucul_set_canvas_size(cv, width, height) < 0)
    10088    {
    10189#if defined(HAVE_ERRNO_H)
Note: See TracChangeset for help on using the changeset viewer.