Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (11 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

File:
1 edited

Legend:

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

    r2519 r2821  
    3232#endif
    3333
    34 #include "cucul.h"
    3534#include "caca.h"
    3635#include "caca_internals.h"
     
    4948#endif
    5049
    51 /** \brief Attach a caca graphical context to a cucul canvas.
     50/** \brief Attach a caca graphical context to a caca canvas.
    5251 *
    5352 *  Create a graphical context using device-dependent features (ncurses for
    5453 *  terminals, an X11 window, a DOS command window...) that attaches to a
    55  *  libcucul canvas. Everything that gets drawn in the libcucul canvas can
     54 *  libcaca canvas. Everything that gets drawn in the libcaca canvas can
    5655 *  then be displayed by the libcaca driver.
    5756 *
    58  *  If no cucul canvas is provided, a new one is created. Its handle can be
     57 *  If no caca canvas is provided, a new one is created. Its handle can be
    5958 *  retrieved using caca_get_canvas() and it is automatically destroyed when
    6059 *  caca_free_display() is called.
     
    6665 *  - \c ENODEV Graphical device could not be initialised.
    6766 *
    68  *  \param cv The cucul canvas or NULL to create a canvas automatically.
     67 *  \param cv The caca canvas or NULL to create a canvas automatically.
    6968 *  \return The caca graphical context or NULL if an error occurred.
    7069 */
    71 caca_display_t * caca_create_display(cucul_canvas_t *cv)
     70caca_display_t * caca_create_display(caca_canvas_t *cv)
    7271{
    7372    return caca_create_display_with_driver(cv, NULL);
    7473}
    7574
    76 /** \brief Attach a specific caca graphical context to a cucul canvas.
     75/** \brief Attach a specific caca graphical context to a caca canvas.
    7776 *
    7877 *  Create a graphical context using device-dependent features (ncurses for
    7978 *  terminals, an X11 window, a DOS command window...) that attaches to a
    80  *  libcucul canvas. Everything that gets drawn in the libcucul canvas can
     79 *  libcaca canvas. Everything that gets drawn in the libcaca canvas can
    8180 *  then be displayed by the libcaca driver.
    8281 *
    83  *  If no cucul canvas is provided, a new one is created. Its handle can be
     82 *  If no caca canvas is provided, a new one is created. Its handle can be
    8483 *  retrieved using caca_get_canvas() and it is automatically destroyed when
    8584 *  caca_free_display() is called.
     
    9493 *  - \c ENODEV Graphical device could not be initialised.
    9594 *
    96  *  \param cv The cucul canvas or NULL to create a canvas automatically.
     95 *  \param cv The caca canvas or NULL to create a canvas automatically.
    9796 *  \param driver A string describing the desired output driver or NULL to
    9897 *                choose the best driver automatically.
    9998 *  \return The caca graphical context or NULL if an error occurred.
    10099 */
    101 caca_display_t * caca_create_display_with_driver(cucul_canvas_t *cv,
     100caca_display_t * caca_create_display_with_driver(caca_canvas_t *cv,
    102101                                                 char const *driver)
    103102{
     
    112111    if((dp->autorelease = (cv == NULL)))
    113112    {
    114         cv = cucul_create_canvas(0, 0);
     113        cv = caca_create_canvas(0, 0);
    115114    }
    116115
    117116    dp->cv = cv;
    118117
    119     if(cucul_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp))
     118    if(caca_manage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp))
    120119    {
    121120        if(dp->autorelease)
    122             cucul_free_canvas(dp->cv);
     121            caca_free_canvas(dp->cv);
    123122        free(dp);
    124123        seterrno(EBUSY);
     
    128127    if(caca_install_driver(dp, driver))
    129128    {
    130         cucul_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp);
     129        caca_unmanage_canvas(cv, (int (*)(void *))caca_can_resize, (void *)dp);
    131130        if(dp->autorelease)
    132             cucul_free_canvas(dp->cv);
     131            caca_free_canvas(dp->cv);
    133132        free(dp);
    134133        seterrno(ENODEV);
     
    224223}
    225224
    226 /** \brief Detach a caca graphical context from a cucul backend context.
    227  *
    228  *  Detach a graphical context from its cucul backend and destroy it. The
    229  *  libcucul canvas continues to exist and other graphical contexts can be
     225/** \brief Detach a caca graphical context from a caca backend context.
     226 *
     227 *  Detach a graphical context from its caca backend and destroy it. The
     228 *  libcaca canvas continues to exist and other graphical contexts can be
    230229 *  attached to it afterwards.
    231230 *
    232  *  If the cucul canvas was automatically created by caca_create_display(),
     231 *  If the caca canvas was automatically created by caca_create_display(),
    233232 *  it is automatically destroyed and any handle to it becomes invalid.
    234233 *
     
    241240{
    242241    caca_uninstall_driver(dp);
    243     cucul_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp);
     242    caca_unmanage_canvas(dp->cv, (int (*)(void *))caca_can_resize, (void *)dp);
    244243    if(dp->autorelease)
    245         cucul_free_canvas(dp->cv);
     244        caca_free_canvas(dp->cv);
    246245    free(dp);
    247246
     
    251250/** \brief Get the canvas attached to a caca graphical context.
    252251 *
    253  *  Return a handle on the \e cucul_canvas_t object that was either attached
     252 *  Return a handle on the \e caca_canvas_t object that was either attached
    254253 *  or created by caca_create_display().
    255254 *
     
    257256 *
    258257 *  \param dp The libcaca graphical context.
    259  *  \return The libcucul canvas.
    260  */
    261 cucul_canvas_t * caca_get_canvas(caca_display_t *dp)
     258 *  \return The libcaca canvas.
     259 */
     260caca_canvas_t * caca_get_canvas(caca_display_t *dp)
    262261{
    263262    return dp->cv;
     
    331330
    332331    /* Mouse position */
    333     dp->mouse.x = cucul_get_canvas_width(dp->cv) / 2;
    334     dp->mouse.y = cucul_get_canvas_height(dp->cv) / 2;
     332    dp->mouse.x = caca_get_canvas_width(dp->cv) / 2;
     333    dp->mouse.y = caca_get_canvas_height(dp->cv) / 2;
    335334
    336335    /* Resize events */
Note: See TracChangeset for help on using the changeset viewer.