Changeset 540 for libcaca


Ignore:
Timestamp:
Mar 7, 2006, 10:17:35 AM (15 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.
Location:
libcaca/trunk
Files:
22 edited

Legend:

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

    r539 r540  
    2222#include "config.h"
    2323
    24 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    25 #   include <inttypes.h>
    26 #else
    27 typedef unsigned int uint32_t;
    28 typedef unsigned char uint8_t;
    29 #endif
    30 
    3124#include <stdlib.h>
    3225#include <string.h>
     
    3831
    3932static int caca_init_driver(caca_t *kk);
    40 static void caca_init_terminal(caca_t *kk);
    41 
     33static void caca_check_terminal(caca_t *kk);
     34
     35/** \brief Attach a caca graphical context to a cucul backend context.
     36 *
     37 *  Create a graphical context using device-dependent features (ncurses for
     38 *  terminals, an X11 window, a DOS command window...) that attaches to a
     39 *  libcucul canvas. Everything that gets drawn in the libcucul canvas can
     40 *  then be displayed by the libcaca driver.
     41 *
     42 *  \param qq The cucul backend context.
     43 *  \return The caca graphical context or NULL if an error occurred.
     44 */
    4245caca_t * caca_attach(cucul_t * qq)
    4346{
    44     int ret;
    4547    caca_t *kk = malloc(sizeof(caca_t));
    4648
    47     ret = caca_init_driver(kk);
    48 
    49     if(ret)
     49    kk->qq = qq;
     50
     51    if(caca_init_driver(kk))
    5052    {
    5153        free(kk);
     
    5355    }
    5456
    55     qq->refcount++;
    56     kk->qq = qq;
    57 
    58     /* Only for slang and ncurses */
    59     caca_init_terminal(kk);
    60 
    61     if(_caca_init_graphics(kk))
    62     {
    63         qq->refcount--;
     57    /* Only needed for slang and ncurses */
     58    caca_check_terminal(kk);
     59
     60    if(kk->driver.init_graphics(kk))
     61    {
    6462        free(kk);
    6563        return NULL;
    6664    }
    6765
    68     /* Initialise events stuff */
     66    /* Attached! */
     67    kk->qq->refcount++;
     68
     69    /* Graphics stuff */
     70    kk->delay = 0;
     71    kk->rendertime = 0;
     72
     73    /* Events stuff */
     74#if defined(USE_SLANG) || defined(USE_NCURSES)
    6975    kk->events.key_timer.last_sec = 0;
    7076    kk->events.key_timer.last_usec = 0;
     
    7278    kk->events.autorepeat_ticks = 0;
    7379    kk->events.last_key = 0;
     80#endif
    7481
    7582    kk->timer.last_sec = 0;
     
    8390}
    8491
     92/** \brief Detach a caca graphical context from a cucul backend context.
     93 *
     94 *  Detach a graphical context from its cucul backend and destroy it. The
     95 *  libcucul canvas continues to exist and other graphical contexts can be
     96 *  attached to it afterwards.
     97 *
     98 *  \param qq The caca graphical context.
     99 */
    85100void caca_detach(caca_t *kk)
    86101{
     
    176191}
    177192
    178 static void caca_init_terminal(caca_t *kk)
     193static void caca_check_terminal(caca_t *kk)
    179194{
    180195#if defined(HAVE_GETENV) && defined(HAVE_PUTENV) && \
  • libcaca/trunk/caca/caca_internals.h

    r539 r540  
    2121#define __CACA_INTERNALS_H__
    2222
     23#if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
     24#   include <inttypes.h>
     25#else
     26typedef unsigned char uint8_t;
     27typedef unsigned short uint16_t;
     28typedef unsigned int uint32_t;
     29#endif
     30
    2331#if defined(USE_GL)
    2432#   include <GL/glut.h>
     
    103111        unsigned int (* get_window_height) (caca_t *);
    104112        void (* display) (caca_t *);
    105         void (* handle_resize) (caca_t *);
     113        void (* handle_resize) (caca_t *, unsigned int *, unsigned int *);
    106114    } driver;
    107115
     
    125133    } events;
    126134
     135    /* FIXME: maybe this should go away */
    127136#if defined(USE_X11) && !defined(_DOXYGEN_SKIP_ME)
    128137    struct x11
     
    164173        HANDLE front, back;
    165174        CHAR_INFO *buffer;
     175        CONSOLE_CURSOR_INFO cci;
    166176    } win32;
    167177#endif
     
    189199};
    190200
    191 /* Initialisation functions */
    192 extern int _caca_init_graphics(caca_t *kk);
    193 extern int _caca_end_graphics(caca_t *kk);
    194 
    195201/* Timer functions */
    196202extern void _caca_sleep(unsigned int);
    197203extern unsigned int _caca_getticks(struct caca_timer *);
    198204
    199 /* Cached screen size */
    200 extern unsigned int _caca_width;
    201 extern unsigned int _caca_height;
    202 extern int _caca_resize;
    203 extern int _caca_resize_event;
    204 
    205205#endif /* __CACA_INTERNALS_H__ */
  • libcaca/trunk/caca/driver_conio.c

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_conio.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief DOS/conio.h driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca DOS/conio.h 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_CONIO)
     
    5144#include "cucul_internals.h"
    5245
    53 #if !defined(_DOXYGEN_SKIP_ME)
    54 int conio_init_graphics(caca_t *kk)
     46static int conio_init_graphics(caca_t *kk)
    5547{
    5648    _wscroll = 0;
     
    7365}
    7466
    75 int conio_end_graphics(caca_t *kk)
     67static int conio_end_graphics(caca_t *kk)
    7668{
    7769    _wscroll = 1;
     
    8678    return 0;
    8779}
    88 #endif /* _DOXYGEN_SKIP_ME */
    8980
    90 int conio_set_window_title(caca_t *kk, char const *title)
     81static int conio_set_window_title(caca_t *kk, char const *title)
    9182{
    9283    return 0;
    9384}
    9485
    95 unsigned int conio_get_window_width(caca_t *kk)
     86static unsigned int conio_get_window_width(caca_t *kk)
    9687{
    9788    /* Fallback to a 6x10 font */
     
    9990}
    10091
    101 unsigned int conio_get_window_height(caca_t *kk)
     92static unsigned int conio_get_window_height(caca_t *kk)
    10293{
    10394    /* Fallback to a 6x10 font */
     
    10596}
    10697
    107 void conio_display(caca_t *kk)
     98static void conio_display(caca_t *kk)
    10899{
    109100    int n;
     
    123114}
    124115
    125 void conio_handle_resize(caca_t *kk)
     116static void conio_handle_resize(caca_t *kk, unsigned int *new_width,
     117                                            unsigned int *new_height)
    126118{
    127     return;
     119    *new_width = kk->qq->width;
     120    *new_height = kk->qq->height;
    128121}
    129122
  • libcaca/trunk/caca/driver_gl.c

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_gl.c
    1313 *  \version \$Id$
    14  *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     14 *  \author Jean-Yves Lamoureux <jylam@lnxscene.org>
     15 *  \brief OpenGL driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca OpenGL 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_GL)
     
    8376static void gl_handle_mouse_motion(int, int);
    8477
    85 int gl_init_graphics(caca_t *kk)
     78static int gl_init_graphics(caca_t *kk)
    8679{
    8780    char *empty_texture;
     
    187180}
    188181
    189 int gl_end_graphics(caca_t *kk)
     182static int gl_end_graphics(caca_t *kk)
    190183{
    191184    glutDestroyWindow(kk->gl.window);
     
    193186}
    194187
    195 int gl_set_window_title(caca_t *kk, char const *title)
     188static int gl_set_window_title(caca_t *kk, char const *title)
    196189{
    197190    glutSetWindowTitle(title);
     
    199192}
    200193
    201 unsigned int gl_get_window_width(caca_t *kk)
     194static unsigned int gl_get_window_width(caca_t *kk)
    202195{
    203196    return kk->gl.width;
    204197}
    205198
    206 unsigned int gl_get_window_height(caca_t *kk)
     199static unsigned int gl_get_window_height(caca_t *kk)
    207200{
    208201    return kk->gl.height;
    209202}
    210203
    211 void gl_display(caca_t *kk)
     204static void gl_display(caca_t *kk)
    212205{
    213206    unsigned int x, y, line;
     
    282275}
    283276
    284 void gl_handle_resize(caca_t *kk)
    285 {
    286     unsigned int new_width, new_height;
    287 
    288     new_width = kk->qq->width;
    289     new_height = kk->qq->height;
    290 
     277static void gl_handle_resize(caca_t *kk, unsigned int *new_width,
     278                                         unsigned int *new_height)
     279{
    291280    kk->gl.width = kk->gl.new_width;
    292281    kk->gl.height = kk->gl.new_height;
    293282
    294     new_width = kk->gl.width / kk->gl.font_width;
    295     new_height = (kk->gl.height / kk->gl.font_height) + 1;
     283    *new_width = kk->gl.width / kk->gl.font_width;
     284    *new_height = (kk->gl.height / kk->gl.font_height) + 1;
    296285
    297286    glMatrixMode(GL_PROJECTION);
  • 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);
  • libcaca/trunk/caca/driver_slang.c

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_slang.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief SLang driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca SLang 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_SLANG)
     
    113106};
    114107
    115 int slang_init_graphics(caca_t *);
    116 int slang_end_graphics(caca_t *);
    117 int slang_set_window_title(caca_t *, char const *);
    118 unsigned int slang_get_window_width(caca_t *);
    119 unsigned int slang_get_window_height(caca_t *);
    120 void slang_display(caca_t *);
    121 void slang_handle_resize(caca_t *);
    122 
    123108/*
    124109 * Local functions
     
    131116#endif
    132117
    133 #if !defined(_DOXYGEN_SKIP_ME)
    134 int slang_init_graphics(caca_t *kk)
     118static int slang_init_graphics(caca_t *kk)
    135119{
    136120#if defined(HAVE_SIGNAL)
     
    146130    {
    147131        SLsig_unblock_signals();
    148         return NULL;
     132        return -1;
    149133    }
    150134
     
    154138    {
    155139        SLsig_unblock_signals();
    156         return NULL;
     140        return -1;
    157141    }
    158142
     
    180164}
    181165
    182 int slang_end_graphics(caca_t *kk)
     166static int slang_end_graphics(caca_t *kk)
    183167{
    184168    SLtt_set_mouse_mode(0, 0);
     
    189173    return 0;
    190174}
    191 #endif /* _DOXYGEN_SKIP_ME */
    192 
    193 int slang_set_window_title(caca_t *kk, char const *title)
    194 {
     175
     176static int slang_set_window_title(caca_t *kk, char const *title)
     177{
     178    /* FIXME */
    195179    return 0;
    196180}
    197181
    198 unsigned int slang_get_window_width(caca_t *kk)
     182static unsigned int slang_get_window_width(caca_t *kk)
    199183{
    200184    /* Fallback to a 6x10 font */
     
    202186}
    203187
    204 unsigned int slang_get_window_height(caca_t *kk)
     188static unsigned int slang_get_window_height(caca_t *kk)
    205189{
    206190    /* Fallback to a 6x10 font */
     
    208192}
    209193
    210 void slang_display(caca_t *kk)
     194static void slang_display(caca_t *kk)
    211195{
    212196    int x, y;
     
    251235}
    252236
     237static void slang_handle_resize(caca_t *kk, unsigned int *new_width,
     238                                            unsigned int *new_height)
     239{
     240    SLtt_get_screen_size();
     241    *new_width = SLtt_Screen_Cols;
     242    *new_height = SLtt_Screen_Rows;
     243
     244    if(*new_width != kk->qq->width || *new_height != kk->qq->height)
     245        SLsmg_reinit_smg();
     246}
     247
    253248/*
    254249 * XXX: following functions are local
    255250 */
    256 
    257 void slang_handle_resize(caca_t *kk)
    258 {
    259     unsigned int new_width, new_height;
    260 
    261     new_width = kk->qq->width;
    262     new_height = kk->qq->height;
    263 
    264     SLtt_get_screen_size();
    265     new_width = SLtt_Screen_Cols;
    266     new_height = SLtt_Screen_Rows;
    267 
    268     if(new_width != kk->qq->width || new_height != kk->qq->height)
    269         SLsmg_reinit_smg();
    270 }
    271251
    272252static void slang_init_palette(void)
  • libcaca/trunk/caca/driver_win32.c

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_win32.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief Win32 driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca Win32 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_WIN32)
     
    8881};
    8982
    90 int win32_init_graphics(caca_t *);
    91 int win32_end_graphics(caca_t *);
    92 int win32_set_window_title(caca_t *, char const *);
    93 unsigned int win32_get_window_width(caca_t *);
    94 unsigned int win32_get_window_height(caca_t *);
    95 void win32_display(caca_t *);
    96 void win32_handle_resize(caca_t *);
    97 
    98 int win32_init_graphics(caca_t *kk)
    99 {
    100     CONSOLE_CURSOR_INFO cci;
     83static int win32_init_graphics(caca_t *kk)
     84{
    10185    CONSOLE_SCREEN_BUFFER_INFO csbi;
    10286    COORD size;
     
    11296        return -1;
    11397
    114     GetConsoleCursorInfo(kk->win32.hout, &cci);
    115     cci.bVisible = FALSE;
    116     SetConsoleCursorInfo(kk->win32.hout, &cci);
     98    GetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
     99    kk->win32.cci.bVisible = FALSE;
     100    SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
    117101
    118102    SetConsoleMode(kk->win32.hout, ENABLE_MOUSE_INPUT);
     
    145129    SetConsoleMode(kk->win32.back, 0);
    146130
    147     GetConsoleCursorInfo(kk->win32.front, &cci);
    148     cci.dwSize = 0;
    149     cci.bVisible = FALSE;
    150     SetConsoleCursorInfo(kk->win32.front, &cci);
    151     SetConsoleCursorInfo(kk->win32.back, &cci);
     131    GetConsoleCursorInfo(kk->win32.front, &kk->win32.cci);
     132    kk->win32.cci.dwSize = 0;
     133    kk->win32.cci.bVisible = FALSE;
     134    SetConsoleCursorInfo(kk->win32.front, &kk->win32.cci);
     135    SetConsoleCursorInfo(kk->win32.back, &kk->win32.cci);
    152136
    153137    SetConsoleActiveScreenBuffer(kk->win32.front);
     
    161145}
    162146
    163 int win32_end_graphics(caca_t *kk)
     147static int win32_end_graphics(caca_t *kk)
    164148{
    165149    SetConsoleActiveScreenBuffer(kk->win32.hout);
     
    171155                                             | FOREGROUND_GREEN
    172156                                             | FOREGROUND_BLUE);
    173     cci.bVisible = TRUE;
    174     SetConsoleCursorInfo(kk->win32.hout, &cci);
     157    kk->win32.cci.bVisible = TRUE;
     158    SetConsoleCursorInfo(kk->win32.hout, &kk->win32.cci);
    175159    CloseHandle(kk->win32.hout);
    176160
     
    178162}
    179163
    180 int win32_set_window_title(caca_t *kk, char const *title)
     164static int win32_set_window_title(caca_t *kk, char const *title)
    181165{
    182166    SetConsoleTitle(title);
     
    184168}
    185169
    186 unsigned int win32_get_window_width(caca_t *kk)
     170static unsigned int win32_get_window_width(caca_t *kk)
    187171{
    188172    /* FIXME */
     
    192176}
    193177
    194 unsigned int win32_get_window_height(caca_t *kk)
     178static unsigned int win32_get_window_height(caca_t *kk)
    195179{
    196180    /* FIXME */
     
    200184}
    201185
    202 void win32_display(caca_t *kk)
     186static void win32_display(caca_t *kk)
    203187{
    204188    COORD size, pos;
     
    225209}
    226210
    227 void win32_handle_resize(caca_t *kk)
    228 {
    229     unsigned int new_width, new_height;
    230 
    231     new_width = kk->qq->width;
    232     new_height = kk->qq->height;
    233 
     211static void win32_handle_resize(caca_t *kk, unsigned int *new_width,
     212                                            unsigned int *new_height)
     213{
    234214    /* Nothing to do here. */
     215    *new_width = kk->qq->width;
     216    *new_height = kk->qq->height;
    235217}
    236218
  • libcaca/trunk/caca/driver_x11.c

    r539 r540  
    1010 */
    1111
    12 /** \file graphics.c
     12/** \file driver_x11.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
     15 *  \brief X11 driver
    1616 *
    17  *  This file contains character and string drawing functions.
     17 *  This file contains the libcaca X11 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_X11)
     
    4740#include "cucul_internals.h"
    4841
    49 int x11_init_graphics(caca_t *);
    50 int x11_end_graphics(caca_t *);
    51 int x11_set_window_title(caca_t *, char const *);
    52 unsigned int x11_get_window_width(caca_t *);
    53 unsigned int x11_get_window_height(caca_t *);
    54 void x11_display(caca_t *);
    55 void x11_handle_resize(caca_t *);
    56 
    5742/*
    5843 * Local functions
     
    6045static int x11_error_handler(Display *, XErrorEvent *);
    6146
    62 #if !defined(_DOXYGEN_SKIP_ME)
    63 int x11_init_graphics(caca_t *kk)
     47static int x11_init_graphics(caca_t *kk)
    6448{
    6549    static int const x11_palette[] =
     
    211195}
    212196
    213 int x11_end_graphics(caca_t *kk)
     197static int x11_end_graphics(caca_t *kk)
    214198{
    215199    XSync(kk->x11.dpy, False);
     
    227211    return 0;
    228212}
    229 #endif /* _DOXYGEN_SKIP_ME */
    230 
    231 int x11_set_window_title(caca_t *kk, char const *title)
     213
     214static int x11_set_window_title(caca_t *kk, char const *title)
    232215{
    233216    XStoreName(kk->x11.dpy, kk->x11.window, title);
     
    235218}
    236219
    237 unsigned int x11_get_window_width(caca_t *kk)
     220static unsigned int x11_get_window_width(caca_t *kk)
    238221{
    239222    return kk->qq->width * kk->x11.font_width;
    240223}
    241224
    242 unsigned int x11_get_window_height(caca_t *kk)
     225static unsigned int x11_get_window_height(caca_t *kk)
    243226{
    244227    return kk->qq->height * kk->x11.font_height;
    245228}
    246229
    247 void x11_display(caca_t *kk)
     230static void x11_display(caca_t *kk)
    248231{
    249232    unsigned int x, y, len;
     
    309292}
    310293
    311 void x11_handle_resize(caca_t *kk)
    312 {
    313     unsigned int new_width, new_height;
    314 
     294static void x11_handle_resize(caca_t *kk, unsigned int *new_width,
     295                                          unsigned int *new_height)
     296{
    315297    Pixmap new_pixmap;
    316298
    317     new_width = kk->qq->width;
    318     new_height = kk->qq->height;
    319 
    320     new_width = kk->x11.new_width;
    321     new_height = kk->x11.new_height;
     299    *new_width = kk->x11.new_width;
     300    *new_height = kk->x11.new_height;
    322301
    323302    new_pixmap = XCreatePixmap(kk->x11.dpy, kk->x11.window,
  • libcaca/trunk/caca/event.c

    r539 r540  
    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 char uint8_t;
    26 #endif
    2721
    2822#if defined(USE_SLANG)
     
    659653        for( ; ; )
    660654        {
    661             GetNumberOfConsoleInputEvents(win32_hin, &num);
     655            GetNumberOfConsoleInputEvents(kk->win32.hin, &num);
    662656            if(num == 0)
    663657                break;
    664658
    665             ReadConsoleInput(win32_hin, &rec, 1, &num);
     659            ReadConsoleInput(kk->win32.hin, &rec, 1, &num);
    666660            if(rec.EventType == KEY_EVENT)
    667661            {
  • libcaca/trunk/caca/graphics.c

    r539 r540  
    2020#include "config.h"
    2121
    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
    28 
    2922#include <stdio.h> /* BUFSIZ */
    3023#include <string.h>
     
    4437 */
    4538static void caca_handle_resize(caca_t *kk);
    46 
    47 #if !defined(_DOXYGEN_SKIP_ME)
    48 int _caca_init_graphics(caca_t *kk)
    49 {
    50     int ret = kk->driver.init_graphics(kk);
    51 
    52     if(!ret)
    53         return ret;
    54 
    55     kk->delay = 0;
    56     kk->rendertime = 0;
    57 
    58     return 0;
    59 }
    60 
    61 int _caca_end_graphics(caca_t *kk)
    62 {
    63     return kk->driver.end_graphics(kk);
    64 }
    65 #endif /* _DOXYGEN_SKIP_ME */
    6639
    6740/** \brief Set the window title.
     
    192165    unsigned int new_width, new_height;
    193166
    194     new_width = kk->qq->width;
    195     new_height = kk->qq->height;
    196 
    197     kk->driver.handle_resize(kk);
     167    kk->driver.handle_resize(kk, &new_width, &new_height);
    198168
    199169    /* Tell libcucul we changed size */
  • libcaca/trunk/cucul/bitmap.c

    r536 r540  
    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 char uint8_t;
    26 typedef unsigned short uint16_t;
    27 typedef unsigned int uint32_t;
    28 #endif
    2921
    3022#if defined(HAVE_ENDIAN_H)
  • libcaca/trunk/cucul/box.c

    r536 r540  
    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 char uint8_t;
    26 #endif
    2721
    2822#include <stdlib.h>
  • libcaca/trunk/cucul/char.c

    r536 r540  
    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#include <stdio.h> /* BUFSIZ */
     
    10396        return;
    10497
    105     qq->chars[x + y * qq->width] = c & 0x7f; /* FIXME: ASCII-only */
     98    qq->chars[x + y * qq->width] = c & 0x0000007f; /* FIXME: ASCII-only */
    10699    qq->attr[x + y * qq->width] = (qq->bgcolor << 4) | qq->fgcolor;
    107100}
     
    152145    while(*t)
    153146    {
    154         *chars++ = *t++ & 0x7f; /* FIXME: ASCII-only */
     147        *chars++ = *t++ & 0x0000007f; /* FIXME: ASCII-only */
    155148        *attr++ = (qq->bgcolor << 4) | qq->fgcolor;
    156149    }
  • libcaca/trunk/cucul/conic.c

    r536 r540  
    2020
    2121#include "config.h"
    22 
    23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    24 #   include <inttypes.h>
    25 #else
    26 typedef unsigned char uint8_t;
    27 #endif
    2822
    2923#include <stdlib.h>
  • libcaca/trunk/cucul/cucul.c

    r536 r540  
    2020
    2121#include "config.h"
    22 
    23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    24 #   include <inttypes.h>
    25 #else
    26 typedef unsigned int uint32_t;
    27 typedef unsigned char uint8_t;
    28 #endif
    2922
    3023#include <stdlib.h>
  • libcaca/trunk/cucul/cucul_internals.h

    r536 r540  
    2121#define __CUCUL_INTERNALS_H__
    2222
     23#if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
     24#   include <inttypes.h>
     25#else
     26typedef unsigned char uint8_t;
     27typedef unsigned char uint16_t;
     28typedef unsigned int uint32_t;
     29#endif
     30
    2331struct cucul_context
    2432{
     
    2836    uint32_t *chars;
    2937    uint8_t *attr;
    30     uint8_t *empty_line, *scratch_line;
     38    char *empty_line, *scratch_line;
    3139
    3240    enum cucul_color fgcolor;
  • libcaca/trunk/cucul/export.c

    r536 r540  
    1010 */
    1111
    12 /** \file char.c
     12/** \file export.c
    1313 *  \version \$Id$
    1414 *  \author Sam Hocevar <sam@zoy.org>
    15  *  \brief Character drawing
    16  *
    17  *  This file contains character and string drawing functions.
     15 *  \author Jean-Yves Lamoureux <jylam@lnxscene.org>
     16 *  \brief Export function
     17 *
     18 *  This file contains export functions for various file formats such
     19 *  as HTML or IRC.
    1820 */
    1921
    2022#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
    2823
    2924#include <stdlib.h>
  • libcaca/trunk/cucul/line.c

    r536 r540  
    2020
    2121#include "config.h"
    22 
    23 #if defined(HAVE_INTTYPES_H) || defined(_DOXYGEN_SKIP_ME)
    24 #   include <inttypes.h>
    25 #else
    26 typedef unsigned char uint8_t;
    27 #endif
    2822
    2923#include <stdlib.h>
  • libcaca/trunk/cucul/math.c

    r536 r540  
    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 char uint8_t;
    26 #endif
    2721
    2822#include <stdlib.h>
  • libcaca/trunk/cucul/sprite.c

    r536 r540  
    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 char uint8_t;
    26 #endif
    2721
    2822#include <stdio.h>
  • libcaca/trunk/cucul/triangle.c

    r536 r540  
    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 char uint8_t;
    26 #endif
    2721
    2822#include <stdlib.h>
  • libcaca/trunk/src/cacaview.c

    r527 r540  
    681681
    682682    /* Create the libcaca bitmap */
    683     bitmap = caca_create_bitmap(bpp, w, h, depth * w,
    684                                 rmask, gmask, bmask, amask);
     683    bitmap = cucul_create_bitmap(qq, bpp, w, h, depth * w,
     684                                 rmask, gmask, bmask, amask);
    685685    if(!bitmap)
    686686    {
     
    691691
    692692    if(bpp == 8)
    693         caca_set_bitmap_palette(bitmap, red, green, blue, alpha);
     693        cucul_set_bitmap_palette(qq, bitmap, red, green, blue, alpha);
    694694#endif
    695695}
Note: See TracChangeset for help on using the changeset viewer.