Ignore:
Timestamp:
Mar 8, 2006, 11:33:01 AM (14 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/driver_slang.c

    r549 r550  
    2727#   include <slang.h>
    2828#endif
     29
     30#include <stdlib.h>
     31#include <string.h>
    2932
    3033#if defined(HAVE_SIGNAL_H)
     
    107110static caca_t *sigwinch_kk; /* FIXME: we ought to get rid of this */
    108111#endif
     112#if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     113static void slang_check_terminal(void);
     114#endif
    109115
    110116static int slang_init_graphics(caca_t *kk)
    111117{
     118#if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     119    slang_check_terminal();
     120#endif
     121
    112122#if defined(HAVE_SIGNAL)
    113123    sigwinch_kk = kk;
     
    376386#endif
    377387
     388#if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     389static void slang_check_terminal(void)
     390{
     391    char *term, *colorterm, *other;
     392
     393    term = getenv("TERM");
     394    colorterm = getenv("COLORTERM");
     395
     396    if(term && !strcmp(term, "xterm"))
     397    {
     398        /* If we are using gnome-terminal, it's really a 16 colour terminal */
     399        if(colorterm && !strcmp(colorterm, "gnome-terminal"))
     400        {
     401            (void)putenv("TERM=xterm-16color");
     402            return;
     403        }
     404
     405        /* Ditto if we are using Konsole */
     406        other = getenv("KONSOLE_DCOP_SESSION");
     407        if(other)
     408        {
     409            (void)putenv("TERM=xterm-16color");
     410            return;
     411        }
     412    }
     413}
     414#endif
     415
    378416/*
    379417 * Driver initialisation
     
    382420void slang_init_driver(caca_t *kk)
    383421{
    384     kk->driver.driver = CACA_DRIVER_SLANG;
    385 
    386     kk->driver.init_graphics = slang_init_graphics;
    387     kk->driver.end_graphics = slang_end_graphics;
    388     kk->driver.set_window_title = slang_set_window_title;
    389     kk->driver.get_window_width = slang_get_window_width;
    390     kk->driver.get_window_height = slang_get_window_height;
    391     kk->driver.display = slang_display;
    392     kk->driver.handle_resize = slang_handle_resize;
    393     kk->driver.get_event = slang_get_event;
     422    kk->drv.driver = CACA_DRIVER_SLANG;
     423
     424    kk->drv.init_graphics = slang_init_graphics;
     425    kk->drv.end_graphics = slang_end_graphics;
     426    kk->drv.set_window_title = slang_set_window_title;
     427    kk->drv.get_window_width = slang_get_window_width;
     428    kk->drv.get_window_height = slang_get_window_height;
     429    kk->drv.display = slang_display;
     430    kk->drv.handle_resize = slang_handle_resize;
     431    kk->drv.get_event = slang_get_event;
    394432}
    395433
Note: See TracChangeset for help on using the changeset viewer.