Changeset 231


Ignore:
Timestamp:
Nov 29, 2003, 3:41:37 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • configure.ac: + Default to ncurses, not slang, because slang only has 128 colour pairs.
  • src/caca.c: + Disable scrolling to avoid hashmap scrolling optimization code.
  • src/graphics.c: + Swap fg and bg in the colour pair indexing, so that bg is always

right.

+ Disable alt charset support to exploit my patched slang.

Location:
libcaca/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/NOTES

    r230 r231  
    118118   o  S-Lang:
    119119
     120      256 character pairs are definable, but only 128 can be used. This is
     121      because slsmg.c's This_Color variable uses its 8th bit to indicate an
     122      alternate character set. Replacing a few 0x7F with 0xFF in sldisply.c
     123      works around the problem but gets rid of the alternate charset.
     124
    120125   o  MS-DOS: all bright colours, bright backgrounds, and bright combinations
    121126      work using <conio.h>. No need to kludge anything.
  • libcaca/trunk/configure.ac

    r227 r231  
    1818AC_EGREP_CPP(foo,foo)
    1919
     20AC_ARG_ENABLE(ncurses,
     21  [  --enable-ncurses        ncurses graphics support (default enabled)])
    2022AC_ARG_ENABLE(slang,
    21   [  --enable-slang          slang graphics support (default enabled)])
    22 AC_ARG_ENABLE(ncurses,
    23   [  --enable-ncurses        ncurses graphics support (default disabled)])
     23  [  --enable-slang          slang graphics support (default disabled)])
    2424AC_ARG_ENABLE(conio,
    2525  [  --enable-conio          DOS conio.h graphics support (default disabled)])
     
    4141  AC_DEFINE(USE_CONIO, 1, Define if the backend driver is conio.h)
    4242  USE_CONIO=:
    43 elif test "${enable_ncurses}" = "yes"; then
     43elif test "${enable_slang}" = "yes"; then
     44  AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
     45  AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
     46  AC_DEFINE(USE_SLANG, 1, Define if the backend driver is slang)
     47  USE_SLANG=:
     48elif test "${enable_ncurses}" != "no"; then
    4449  AC_CHECK_HEADER(ncurses.h,:,AC_MSG_ERROR([cannot find ncurses headers]))
    4550  AC_CHECK_LIB(ncurses,initscr,:,AC_MSG_ERROR([cannot find ncurses library]))
    4651  AC_DEFINE(USE_NCURSES, 1, Define if the backend driver is ncurses)
    4752  USE_NCURSES=:
    48 elif test "${enable_slang}" != "no"; then
    49   AC_CHECK_HEADER(slang.h,:,AC_MSG_ERROR([cannot find slang headers]))
    50   AC_CHECK_LIB(slang,SLkp_init,:,AC_MSG_ERROR([cannot find slang library]))
    51   AC_DEFINE(USE_SLANG, 1, Define if the backend driver is slang)
    52   USE_SLANG=:
    5353else
    5454  AC_MSG_ERROR([could not find any terminal graphics interface])
  • libcaca/trunk/src/caca.c

    r227 r231  
    9797    SLtt_set_mouse_mode(1, 0);
    9898    SLsmg_refresh();
     99
     100    /* Disable scrolling so that hashmap scrolling optimization code
     101     * does not cause ugly refreshes due to slow terminals */
     102    SLtt_Term_Cannot_Scroll = 1;
    99103
    100104#elif defined(USE_NCURSES)
  • libcaca/trunk/src/graphics.c

    r227 r231  
    4040#endif
    4141
     42#ifdef HAVE_INTTYPES_H
     43#   include <inttypes.h>
     44#endif
     45
    4246#include <stdio.h> /* BUFSIZ */
    4347#include <string.h>
     
    6569    _caca_bgcolor = bgcolor;
    6670#if defined(USE_SLANG)
    67     SLsmg_set_color(fgcolor + 16 * bgcolor);
     71    SLsmg_set_color((bgcolor + 16 * fgcolor) /*% 128*/);
    6872#elif defined(USE_NCURSES)
    6973    attrset(_caca_attr[fgcolor + 16 * bgcolor]);
     
    135139#if defined(USE_SLANG)
    136140    SLsmg_gotorc(y, x);
    137     SLsmg_write_string(s);
     141    SLsmg_write_string((char *)(intptr_t)s);
    138142#elif defined(USE_NCURSES)
    139143    move(y, x);
     
    199203    static char *slang_colors[16] =
    200204    {
     205        /* Standard colours */
    201206        "black",
    202207        "blue",
     
    207212        "brown",
    208213        "lightgray",
     214        /* Bright colours */
    209215        "gray",
    210216        "brightblue",
     
    219225    int fg, bg;
    220226
    221     for(bg = 0; bg < 16; bg++)
    222         for(fg = 0; fg < 16; fg++)
     227    for(fg = 0; fg < 16; fg++)
     228        for(bg = 0; bg < 16; bg++)
    223229        {
    224             int i = fg + 16 * bg;
     230            int i = bg + 16 * fg;
    225231            SLtt_set_color(i, NULL, slang_colors[fg], slang_colors[bg]);
    226232        }
    227233
     234    /* Disable alt charset support so that we get all 256 colour pairs */
     235    SLtt_Has_Alt_Charset = 0;
     236
    228237#elif defined(USE_NCURSES)
    229238    static int curses_colors[] =
    230239    {
     240        /* Standard curses colours */
    231241        COLOR_BLACK,
    232242        COLOR_BLUE,
     
    253263    start_color();
    254264
     265    /* If COLORS == 16, it means the terminal supports full bright colours
     266     * using setab and setaf (will use \e[90m \e[91m etc. for colours >= 8),
     267     * we can build 16*16 colour pairs.
     268     * If COLORS == 8, it means the terminal does not know about bright
     269     * colours and we need to get them through A_BOLD and A_BLINK (\e[1m
     270     * and \e[5m). We can only build 8*8 colour pairs. */
    255271    max = COLORS >= 16 ? 16 : 8;
    256272
     
    272288                _caca_attr[fg + 16 * (bg + 8)] = A_BLINK | COLOR_PAIR(col);
    273289                /* Bright fg on bright bg */
    274                 _caca_attr[fg + 8 + 16 * (bg + 8)] = A_BLINK | A_BOLD | COLOR_PAIR(col);
     290                _caca_attr[fg + 8 + 16 * (bg + 8)] = A_BLINK | A_BOLD
     291                                                             | COLOR_PAIR(col);
    275292            }
    276293        }
Note: See TracChangeset for help on using the changeset viewer.