Ignore:
Timestamp:
Mar 23, 2006, 7:36:59 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Massive rework of the event handling code, as per the TODO list.
File:
1 edited

Legend:

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

    r672 r681  
    114114 *  Event types returned by caca_get_event().
    115115 */
    116 enum caca_event
    117 {
    118     CACA_EVENT_NONE =          0x00000000, /**< No event. */
    119     CACA_EVENT_KEY_PRESS =     0x01000000, /**< A key was pressed. */
    120     CACA_EVENT_KEY_RELEASE =   0x02000000, /**< A key was released. */
    121     CACA_EVENT_MOUSE_PRESS =   0x04000000, /**< A mouse button was pressed. */
    122     CACA_EVENT_MOUSE_RELEASE = 0x08000000, /**< A mouse button was released. */
    123     CACA_EVENT_MOUSE_MOTION =  0x10000000, /**< The mouse was moved. */
    124     CACA_EVENT_RESIZE =        0x20000000, /**< The window was resized. */
    125     CACA_EVENT_ANY =           0xff000000  /**< Bitmask for any event. */
     116enum caca_event_type
     117{
     118    CACA_EVENT_NONE =          0x0000, /**< No event. */
     119
     120    CACA_EVENT_KEY_PRESS =     0x0001, /**< A key was pressed. */
     121    CACA_EVENT_KEY_RELEASE =   0x0002, /**< A key was released. */
     122    CACA_EVENT_MOUSE_PRESS =   0x0004, /**< A mouse button was pressed. */
     123    CACA_EVENT_MOUSE_RELEASE = 0x0008, /**< A mouse button was released. */
     124    CACA_EVENT_MOUSE_MOTION =  0x0010, /**< The mouse was moved. */
     125    CACA_EVENT_RESIZE =        0x0020, /**< The window was resized. */
     126
     127    CACA_EVENT_ANY =           0xffff  /**< Bitmask for any event. */
     128};
     129
     130struct caca_event
     131{
     132    enum caca_event_type type;
     133    union
     134    {
     135        struct { unsigned int x, y, button; } mouse;
     136        struct { unsigned int w, h; } resize;
     137        struct { unsigned int c; unsigned long int ucs4; char utf8[8]; } key;
     138    } data;
    126139};
    127140
     
    197210 *
    198211 *  @{ */
    199 unsigned int caca_get_event(caca_t *kk, unsigned int);
    200 unsigned int caca_wait_event(caca_t *kk, unsigned int);
     212int caca_get_event(caca_t *kk, unsigned int, struct caca_event *);
     213int caca_wait_event(caca_t *kk, unsigned int, struct caca_event *);
    201214unsigned int caca_get_mouse_x(caca_t *kk);
    202215unsigned int caca_get_mouse_y(caca_t *kk);
Note: See TracChangeset for help on using the changeset viewer.