"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "caca/driver/ncurses.c" between
libcaca-0.99.beta19.tar.gz and libcaca-0.99.beta20.tar.bz2

About: libcaca is a graphics library that outputs text instead of pixels, so that it can work on older video cards or text terminals (something like an advanced AAlib library).

ncurses.c  (libcaca-0.99.beta19):ncurses.c  (libcaca-0.99.beta20.tar.bz2)
/* /*
* libcaca Colour ASCII-Art library * libcaca Colour ASCII-Art library
* Copyright (c) 2002-2014 Sam Hocevar <sam@hocevar.net> * Copyright © 2002—2021 Sam Hocevar <sam@hocevar.net>
* 2007 Ben Wiley Sittler <bsittler@gmail.com> * 2007 Ben Wiley Sittler <bsittler@gmail.com>
* All Rights Reserved * All Rights Reserved
* *
* This library is free software. It comes without any warranty, to * This library is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it * the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What the Fuck You Want * and/or modify it under the terms of the Do What the Fuck You Want
* to Public License, Version 2, as published by Sam Hocevar. See * to Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details. * http://www.wtfpl.net/ for more details.
*/ */
/* /*
* This file contains the libcaca Ncurses input and output driver * This file contains the libcaca Ncurses input and output driver
skipping to change at line 191 skipping to change at line 191
#ifndef ACS_VLINE #ifndef ACS_VLINE
#define ACS_VLINE '|' #define ACS_VLINE '|'
#endif #endif
/* /*
* Local functions * Local functions
*/ */
#if defined HAVE_SIGNAL #if defined HAVE_SIGNAL
static RETSIGTYPE sigwinch_handler(int); static void sigwinch_handler(int);
static caca_display_t *sigwinch_d; /* FIXME: we ought to get rid of this */ static caca_display_t *sigwinch_d; /* FIXME: we ought to get rid of this */
#endif #endif
#if defined HAVE_GETENV && defined HAVE_PUTENV #if defined HAVE_GETENV && defined HAVE_PUTENV
static void ncurses_install_terminal(caca_display_t *); static void ncurses_install_terminal(caca_display_t *);
static void ncurses_uninstall_terminal(caca_display_t *); static void ncurses_uninstall_terminal(caca_display_t *);
#endif #endif
static void ncurses_write_utf32(uint32_t); static void ncurses_write_utf32(uint32_t);
struct driver_private struct driver_private
{ {
skipping to change at line 231 skipping to change at line 231
COLOR_BLACK + 8, COLOR_BLACK + 8,
COLOR_BLUE + 8, COLOR_BLUE + 8,
COLOR_GREEN + 8, COLOR_GREEN + 8,
COLOR_CYAN + 8, COLOR_CYAN + 8,
COLOR_RED + 8, COLOR_RED + 8,
COLOR_MAGENTA + 8, COLOR_MAGENTA + 8,
COLOR_YELLOW + 8, COLOR_YELLOW + 8,
COLOR_WHITE + 8 COLOR_WHITE + 8
}; };
#if defined HAVE_LOCALE_H
char const *old_locale;
#endif
mmask_t newmask; mmask_t newmask;
int fg, bg, max; int fg, bg, max;
dp->drv.p = malloc(sizeof(struct driver_private)); dp->drv.p = malloc(sizeof(struct driver_private));
#if defined HAVE_GETENV && defined HAVE_PUTENV #if defined HAVE_GETENV && defined HAVE_PUTENV
ncurses_install_terminal(dp); ncurses_install_terminal(dp);
#endif #endif
#if defined HAVE_SIGNAL #if defined HAVE_SIGNAL
sigwinch_d = dp; sigwinch_d = dp;
signal(SIGWINCH, sigwinch_handler); signal(SIGWINCH, sigwinch_handler);
#endif #endif
#if defined HAVE_LOCALE_H
setlocale(LC_ALL, "");
#endif
_caca_set_term_title("caca for ncurses"); _caca_set_term_title("caca for ncurses");
#if defined HAVE_LOCALE_H
old_locale = setlocale(LC_CTYPE, "");
#endif
initscr(); initscr();
#if defined HAVE_LOCALE_H
setlocale(LC_CTYPE, old_locale);
#endif
keypad(stdscr, TRUE); keypad(stdscr, TRUE);
nonl(); nonl();
raw(); raw();
noecho(); noecho();
nodelay(stdscr, TRUE); nodelay(stdscr, TRUE);
curs_set(0); curs_set(0);
/* Activate mouse */ /* Activate mouse */
newmask = REPORT_MOUSE_POSITION | ALL_MOUSE_EVENTS; newmask = REPORT_MOUSE_POSITION | ALL_MOUSE_EVENTS;
mousemask(newmask, &dp->drv.p->oldmask); mousemask(newmask, &dp->drv.p->oldmask);
skipping to change at line 591 skipping to change at line 597
curs_set(0); curs_set(0);
else if (curs_set(2) == ERR) else if (curs_set(2) == ERR)
curs_set(1); curs_set(1);
} }
/* /*
* XXX: following functions are local * XXX: following functions are local
*/ */
#if defined HAVE_SIGNAL #if defined HAVE_SIGNAL
static RETSIGTYPE sigwinch_handler(int sig) static void sigwinch_handler(int sig)
{ {
sigwinch_d->resize.resized = 1; sigwinch_d->resize.resized = 1;
signal(SIGWINCH, sigwinch_handler); signal(SIGWINCH, sigwinch_handler);
} }
#endif #endif
#if defined HAVE_GETENV && defined HAVE_PUTENV #if defined HAVE_GETENV && defined HAVE_PUTENV
static void ncurses_install_terminal(caca_display_t *dp) static void ncurses_install_terminal(caca_display_t *dp)
{ {
 End of changes. 7 change blocks. 
10 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)