Ignore:
Timestamp:
Nov 25, 2007, 3:12:01 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Introduce cucul_get_canvas_chars() and cucul_get_canvas_attrs() to avoid direct cv->chars and cv->attrs access by display drivers.
File:
1 edited

Legend:

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

    r2049 r2056  
    2626
    2727#include "cucul.h"
    28 #include "cucul_internals.h"
    2928#include "caca.h"
    3029#include "caca_internals.h"
     
    132131unsigned int caca_get_mouse_x(caca_display_t const *dp)
    133132{
    134     if(dp->mouse.x >= dp->cv->width)
    135         return dp->cv->width - 1;
     133    unsigned int width = cucul_get_canvas_width(dp->cv);
     134
     135    if(dp->mouse.x >= width)
     136        return width - 1;
    136137
    137138    return dp->mouse.x;
     
    152153unsigned int caca_get_mouse_y(caca_display_t const *dp)
    153154{
    154     if(dp->mouse.y >= dp->cv->height)
    155         return dp->cv->height - 1;
     155    unsigned int height = cucul_get_canvas_height(dp->cv);
     156
     157    if(dp->mouse.y >= height)
     158        return height - 1;
    156159
    157160    return dp->mouse.y;
     
    334337        _caca_handle_resize(dp);
    335338        ev->type = CACA_EVENT_RESIZE;
    336         ev->data.resize.w = dp->cv->width;
    337         ev->data.resize.h = dp->cv->height;
     339        ev->data.resize.w = cucul_get_canvas_width(dp->cv);
     340        ev->data.resize.h = cucul_get_canvas_height(dp->cv);
    338341        return 1;
    339342    }
Note: See TracChangeset for help on using the changeset viewer.