Ignore:
Timestamp:
Mar 7, 2006, 10:17:35 AM (14 years ago)
Author:
Sam Hocevar
Message:
  • Polished the driver split a bit (still no events, except resize events), properly credited authors and documented a few things.
File:
1 edited

Legend:

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

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_ncurses.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief Ncurses driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca Ncurses input and output driver
    1818 */
    1919
    2020#include "config.h"
    21 
    22 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    23 #   include <inttypes.h>
    24 #else
    25 typedef unsigned int uint32_t;
    26 typedef unsigned char uint8_t;
    27 #endif
    2821
    2922#if defined(USE_NCURSES)
     
    5548#include "cucul_internals.h"
    5649
    57 int ncurses_init_graphics(caca_t *);
    58 int ncurses_end_graphics(caca_t *);
    59 int ncurses_set_window_title(caca_t *, char const *);
    60 unsigned int ncurses_get_window_width(caca_t *);
    61 unsigned int ncurses_get_window_height(caca_t *);
    62 void ncurses_display(caca_t *);
    63 void ncurses_handle_resize(caca_t *);
    64 
    6550/*
    6651 * Local functions
    6752 */
     53
    6854#if defined(HAVE_SIGNAL)
    6955static RETSIGTYPE sigwinch_handler(int);
     
    7157#endif
    7258
    73 int ncurses_init_graphics(caca_t *kk)
     59static int ncurses_init_graphics(caca_t *kk)
    7460{
    7561    static int curses_colors[] =
     
    158144}
    159145
    160 int ncurses_end_graphics(caca_t *kk)
     146static int ncurses_end_graphics(caca_t *kk)
    161147{
    162148    mousemask(kk->ncurses.oldmask, NULL);
     
    168154}
    169155
    170 int ncurses_set_window_title(caca_t *kk, char const *title)
     156static int ncurses_set_window_title(caca_t *kk, char const *title)
    171157{
    172158    return 0;
    173159}
    174160
    175 unsigned int ncurses_get_window_width(caca_t *kk)
     161static unsigned int ncurses_get_window_width(caca_t *kk)
    176162{
    177163    /* Fallback to a 6x10 font */
     
    179165}
    180166
    181 unsigned int ncurses_get_window_height(caca_t *kk)
     167static unsigned int ncurses_get_window_height(caca_t *kk)
    182168{
    183169    /* Fallback to a 6x10 font */
     
    185171}
    186172
    187 void ncurses_display(caca_t *kk)
     173static void ncurses_display(caca_t *kk)
    188174{
    189175    int x, y;
     
    202188}
    203189
    204 void ncurses_handle_resize(caca_t *kk)
    205 {
    206     unsigned int new_width, new_height;
     190static void ncurses_handle_resize(caca_t *kk, unsigned int *new_width,
     191                                              unsigned int *new_height)
     192{
    207193    struct winsize size;
    208194
    209     new_width = kk->qq->width;
    210     new_height = kk->qq->height;
     195    *new_width = kk->qq->width;
     196    *new_height = kk->qq->height;
    211197
    212198    if(ioctl(fileno(stdout), TIOCGWINSZ, &size) == 0)
    213199    {
    214         new_width = size.ws_col;
    215         new_height = size.ws_row;
     200        *new_width = size.ws_col;
     201        *new_height = size.ws_row;
    216202#if defined(HAVE_RESIZE_TERM)
    217         resize_term(new_height, new_width);
     203        resize_term(*new_height, *new_width);
    218204#else
    219         resizeterm(new_height, new_width);
     205        resizeterm(*new_height, *new_width);
    220206#endif
    221207        wrefresh(curscr);
Note: See TracChangeset for help on using the changeset viewer.