Ignore:
Timestamp:
Mar 8, 2006, 11:33:01 AM (15 years ago)
Author:
Sam Hocevar
Message:
  • Finished moving everything driver-specific to the apropriate driver_*.c files. Phew. Now they just need a few comments.
File:
1 edited

Legend:

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

    r541 r550  
    3131
    3232static int caca_init_driver(caca_t *kk);
    33 static void caca_check_terminal(caca_t *kk);
    3433
    3534/** \brief Attach a caca graphical context to a cucul backend context.
     
    5554    }
    5655
    57     /* Only needed for slang and ncurses */
    58     caca_check_terminal(kk);
    59 
    60     if(kk->driver.init_graphics(kk))
     56    if(kk->drv.init_graphics(kk))
    6157    {
    6258        free(kk);
     
    10399void caca_detach(caca_t *kk)
    104100{
    105     kk->driver.end_graphics(kk);
     101    kk->drv.end_graphics(kk);
    106102    kk->qq->refcount--;
    107103    free(kk);
     
    194190}
    195191
    196 static void caca_check_terminal(caca_t *kk)
    197 {
    198 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV) && \
    199      (defined(USE_SLANG) || defined(USE_NCURSES))
    200     char *term, *colorterm, *other;
    201 #endif
    202 
    203 #if defined(USE_SLANG)
    204     if(kk->driver.driver != CACA_DRIVER_SLANG)
    205 #endif
    206 #if defined(USE_NCURSES)
    207     if(kk->driver.driver != CACA_DRIVER_NCURSES)
    208 #endif
    209     return;
    210 
    211 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV) && \
    212      (defined(USE_SLANG) || defined(USE_NCURSES))
    213     term = getenv("TERM");
    214     colorterm = getenv("COLORTERM");
    215 
    216     if(term && !strcmp(term, "xterm"))
    217     {
    218         /* If we are using gnome-terminal, it's really a 16 colour terminal */
    219         if(colorterm && !strcmp(colorterm, "gnome-terminal"))
    220         {
    221 #if defined(USE_NCURSES)
    222             if(kk->driver.driver == CACA_DRIVER_NCURSES)
    223             {
    224                 SCREEN *screen;
    225                 screen = newterm("xterm-16color", stdout, stdin);
    226                 if(screen == NULL)
    227                     return;
    228                 endwin();
    229             }
    230 #endif
    231             (void)putenv("TERM=xterm-16color");
    232             return;
    233         }
    234 
    235         /* Ditto if we are using Konsole */
    236         other = getenv("KONSOLE_DCOP_SESSION");
    237         if(other)
    238         {
    239 #if defined(USE_NCURSES)
    240             if(kk->driver.driver == CACA_DRIVER_NCURSES)
    241             {
    242                 SCREEN *screen;
    243                 screen = newterm("xterm-16color", stdout, stdin);
    244                 if(screen == NULL)
    245                     return;
    246                 endwin();
    247             }
    248 #endif
    249             (void)putenv("TERM=xterm-16color");
    250             return;
    251         }
    252     }
    253 #endif
    254 }
    255 
Note: See TracChangeset for help on using the changeset viewer.