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/driver_x11.c

    r2305 r2821  
    3333#include <string.h>
    3434
    35 #include "cucul.h"
     35#include "caca.h"
    3636#include "caca.h"
    3737#include "caca_internals.h"
     
    7676    char const *fonts[] = { NULL, "8x13bold", "fixed" }, **parser;
    7777    char const *geometry;
    78     int width = cucul_get_canvas_width(dp->cv);
    79     int height = cucul_get_canvas_height(dp->cv);
     78    int width = caca_get_canvas_width(dp->cv);
     79    int height = caca_get_canvas_height(dp->cv);
    8080    int i;
    8181
     
    8989
    9090    dp->resize.allow = 1;
    91     cucul_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32);
    92     width = cucul_get_canvas_width(dp->cv);
    93     height = cucul_get_canvas_height(dp->cv);
     91    caca_set_canvas_size(dp->cv, width ? width : 80, height ? height : 32);
     92    width = caca_get_canvas_width(dp->cv);
     93    height = caca_get_canvas_height(dp->cv);
    9494    dp->resize.allow = 0;
    9595
     
    280280static int x11_get_display_width(caca_display_t const *dp)
    281281{
    282     return cucul_get_canvas_width(dp->cv) * dp->drv.p->font_width;
     282    return caca_get_canvas_width(dp->cv) * dp->drv.p->font_width;
    283283}
    284284
    285285static int x11_get_display_height(caca_display_t const *dp)
    286286{
    287     return cucul_get_canvas_height(dp->cv) * dp->drv.p->font_height;
     287    return caca_get_canvas_height(dp->cv) * dp->drv.p->font_height;
    288288}
    289289
    290290static void x11_display(caca_display_t *dp)
    291291{
    292     uint32_t const *cvchars = (uint32_t const *)cucul_get_canvas_chars(dp->cv);
    293     uint32_t const *cvattrs = (uint32_t const *)cucul_get_canvas_attrs(dp->cv);
    294     int width = cucul_get_canvas_width(dp->cv);
    295     int height = cucul_get_canvas_height(dp->cv);
     292    uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
     293    uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
     294    int width = caca_get_canvas_width(dp->cv);
     295    int height = caca_get_canvas_height(dp->cv);
    296296    int x, y, len;
    297297
     
    303303        {
    304304            uint32_t const *attrs = cvattrs + x + y * width;
    305             uint16_t bg = cucul_attr_to_rgb12_bg(*attrs);
     305            uint16_t bg = caca_attr_to_rgb12_bg(*attrs);
    306306
    307307            len = 1;
    308308            while(x + len < width
    309                    && cucul_attr_to_rgb12_bg(attrs[len]) == bg)
     309                   && caca_attr_to_rgb12_bg(attrs[len]) == bg)
    310310                len++;
    311311
     
    331331        {
    332332            XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
    333                            dp->drv.p->colors[cucul_attr_to_rgb12_fg(*attrs)]);
     333                           dp->drv.p->colors[caca_attr_to_rgb12_fg(*attrs)]);
    334334
    335335            x11_put_glyph(dp, x * dp->drv.p->font_width,
     
    345345        XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
    346346                       dp->drv.p->colors[0xfff]);
    347         x = cucul_get_cursor_x(dp->cv);
    348         y = cucul_get_cursor_y(dp->cv);
     347        x = caca_get_cursor_x(dp->cv);
     348        y = caca_get_cursor_y(dp->cv);
    349349        XFillRectangle(dp->drv.p->dpy, dp->drv.p->pixmap, dp->drv.p->gc,
    350350                       x * dp->drv.p->font_width, y * dp->drv.p->font_height,
     
    379379static int x11_get_event(caca_display_t *dp, caca_privevent_t *ev)
    380380{
    381     int width = cucul_get_canvas_width(dp->cv);
    382     int height = cucul_get_canvas_height(dp->cv);
     381    int width = caca_get_canvas_width(dp->cv);
     382    int height = caca_get_canvas_height(dp->cv);
    383383    XEvent xevent;
    384384    char key;
     
    611611
    612612    /* Underline */
    613     if(attr & CUCUL_UNDERLINE)
     613    if(attr & CACA_UNDERLINE)
    614614        XFillRectangle(dpy, px, gc, x, y + h - 1, w, 1);
    615615
     
    618618        return;
    619619
    620     if(ch == CUCUL_MAGIC_FULLWIDTH)
     620    if(ch == CACA_MAGIC_FULLWIDTH)
    621621        return;
    622622
    623623    fw = w;
    624     if(cucul_utf32_is_fullwidth(ch))
     624    if(caca_utf32_is_fullwidth(ch))
    625625        fw *= 2;
    626626
    627627    /* We want to be able to print a few special Unicode characters
    628628     * such as the CP437 gradients and half blocks. For unknown
    629      * characters, print what cucul_utf32_to_ascii() returns. */
     629     * characters, print what caca_utf32_to_ascii() returns. */
    630630
    631631    if(ch >= 0x2500 && ch <= 0x256c && udlr[ch - 0x2500])
     
    772772    {
    773773        ch16.byte1 = 0;
    774         ch16.byte2 = cucul_utf32_to_ascii(ch);
     774        ch16.byte2 = caca_utf32_to_ascii(ch);
    775775    }
    776776
Note: See TracChangeset for help on using the changeset viewer.