Ignore:
Timestamp:
Mar 24, 2006, 10:48:20 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Allow the driver initialisation to fail, for instance when $DISPLAY = "".
File:
1 edited

Legend:

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

    r681 r684  
    9393    kk->drv.p = malloc(sizeof(struct driver_private));
    9494
     95#if defined(HAVE_GETENV)
    9596    geometry = getenv("CACA_GEOMETRY");
    9697    if(geometry && *geometry)
    9798        sscanf(geometry, "%ux%u", &width, &height);
     99#endif
    98100
    99101    if(width && height)
     
    104106        return -1;
    105107
     108#if defined(HAVE_GETENV)
    106109    fonts[0] = getenv("CACA_FONT");
    107110    if(fonts[0] && *fonts[0])
    108111        parser = fonts;
    109112    else
     113#endif
    110114        parser = fonts + 1;
    111115
     
    544548 */
    545549
    546 void x11_init_driver(caca_t *kk)
    547 {
     550int x11_install(caca_t *kk)
     551{
     552#if defined(HAVE_GETENV)
     553    if(!getenv("DISPLAY") || !*(getenv("DISPLAY")))
     554        return -1;
     555#endif
     556
    548557    kk->drv.driver = CACA_DRIVER_X11;
    549558
     
    556565    kk->drv.handle_resize = x11_handle_resize;
    557566    kk->drv.get_event = x11_get_event;
     567
     568    return 0;
    558569}
    559570
Note: See TracChangeset for help on using the changeset viewer.