Ignore:
Timestamp:
May 26, 2006, 12:32:03 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Fixed UTF-8 support in ncurses.
  • Set ncurses's priority higher than slang.
Location:
libcaca/trunk/caca
Files:
2 edited

Legend:

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

    r980 r984  
    162162    if(gl_install(dp) == 0) return 0;
    163163#endif
    164     /* slang has a higher priority than ncurses because though ncurses handles
    165      * color a bit better across terminals, its UTF-8 supports seems broken. */
     164    /* ncurses has a higher priority than slang because it has better colour
     165     * support across terminal types, despite being slightly slower. */
     166#if defined(USE_NCURSES)
     167    if(ncurses_install(dp) == 0) return 0;
     168#endif
    166169#if defined(USE_SLANG)
    167170    if(slang_install(dp) == 0) return 0;
    168 #endif
    169 #if defined(USE_NCURSES)
    170     if(ncurses_install(dp) == 0) return 0;
    171171#endif
    172172
  • libcaca/trunk/caca/driver_ncurses.c

    r980 r984  
    1919#include "common.h"
    2020
    21 #if defined(USE_NCURSES)
    22 
    23 #if defined(HAVE_NCURSESW_NCURSES_H)
     21#if defined USE_NCURSES
     22
     23#if defined HAVE_NCURSESW_NCURSES_H
    2424#   include <ncursesw/ncurses.h>
    25 #elif defined(HAVE_NCURSES_NCURSES_H)
     25#elif defined HAVE_NCURSES_NCURSES_H
    2626#   include <ncurses/ncurses.h>
    27 #elif defined(HAVE_NCURSES_H)
     27#elif defined HAVE_NCURSES_H
    2828#   include <ncurses.h>
    2929#else
     
    3434#include <string.h>
    3535
    36 #if defined(HAVE_SIGNAL_H)
     36#if defined HAVE_SIGNAL_H
    3737#   include <signal.h>
    3838#endif
    39 #if defined(HAVE_SYS_IOCTL_H)
     39#if defined HAVE_SYS_IOCTL_H
    4040#   include <sys/ioctl.h>
     41#endif
     42#if defined HAVE_LOCALE_H
     43#   include <locale.h>
    4144#endif
    4245
     
    5053 */
    5154
    52 #if defined(HAVE_SIGNAL)
     55#if defined HAVE_SIGNAL
    5356static RETSIGTYPE sigwinch_handler(int);
    5457static caca_display_t *sigwinch_d; /* FIXME: we ought to get rid of this */
    5558#endif
    56 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     59#if defined HAVE_GETENV && defined HAVE_PUTENV
    5760static void ncurses_check_terminal(void);
    5861#endif
     
    9497    dp->drv.p = malloc(sizeof(struct driver_private));
    9598
    96 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     99#if defined HAVE_GETENV && defined HAVE_PUTENV
    97100    ncurses_check_terminal();
    98101#endif
    99102
    100 #if defined(HAVE_SIGNAL)
     103#if defined HAVE_SIGNAL
    101104    sigwinch_d = dp;
    102105    signal(SIGWINCH, sigwinch_handler);
     106#endif
     107
     108#if defined HAVE_LOCALE_H
     109    setlocale(LC_ALL, "");
    103110#endif
    104111
     
    208215    struct winsize size;
    209216
    210 #if defined(HAVE_SYS_IOCTL_H)
     217#if defined HAVE_SYS_IOCTL_H
    211218    if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0)
    212219    {
    213220        dp->resize.w = size.ws_col;
    214221        dp->resize.h = size.ws_row;
    215 #if defined(HAVE_RESIZE_TERM)
     222#if defined HAVE_RESIZE_TERM
    216223        resize_term(dp->resize.h, dp->resize.w);
    217224#else
     
    353360 */
    354361
    355 #if defined(HAVE_SIGNAL)
     362#if defined HAVE_SIGNAL
    356363static RETSIGTYPE sigwinch_handler(int sig)
    357364{
     
    362369#endif
    363370
    364 #if defined(HAVE_GETENV) && defined(HAVE_PUTENV)
     371#if defined HAVE_GETENV && defined HAVE_PUTENV
    365372static void ncurses_check_terminal(void)
    366373{
     
    402409static void ncurses_write_utf32(uint32_t ch)
    403410{
    404 #if defined(HAVE_NCURSESW_NCURSES_H)
     411#if defined HAVE_NCURSESW_NCURSES_H
    405412    char buf[10];
    406413    int bytes;
Note: See TracChangeset for help on using the changeset viewer.