Changeset 849


Ignore:
Timestamp:
Apr 22, 2006, 9:46:43 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Allow the caca_event_t *ev argument for caca_get_event() to be NULL.
Location:
libcaca/trunk
Files:
10 edited

Legend:

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

    r811 r849  
    5151 *  function to wait indefinitely until a matching event is received.
    5252 *
     53 *  If not null, \c ev will be filled with information about the event
     54 *  received. If null, the function will return but no information about
     55 *  the event will be sent.
     56 *
    5357 *  \param dp The libcaca graphical context.
    5458 *  \param event_mask Bitmask of requested events.
    5559 *  \param timeout A timeout value in microseconds
    56  *  \param ev A pointer to a caca_event structure.
    57  *  \return The next matching event in the queue, or 0 if no event is pending.
     60 *  \param ev A pointer to a caca_event structure, or NULL.
     61 *  \return 1 if a matching event was received, or 0 if the wait timeouted.
    5862 */
    5963int caca_get_event(caca_display_t *dp, unsigned int event_mask,
    6064                   caca_event_t *ev, int timeout)
    6165{
     66    caca_event_t dummy_event;
    6267    caca_timer_t timer;
    6368    int usec = 0;
     
    6873    if(timeout > 0)
    6974        _caca_getticks(&timer);
     75
     76    if(ev == NULL)
     77        ev = &dummy_event;
    7078
    7179    for( ; ; )
  • libcaca/trunk/doc/migrating.dox

    r848 r849  
    4848    /* Initialise libcaca */
    4949    cucul_canvas_t *cv;
    50     caca_display_t *dp; caca_event_t ev;
     50    caca_display_t *dp;
    5151    cv = cucul_create_canvas(0, 0);
    5252    dp = caca_create_display(cv);
     
    6262    /* Wait for a key press event */
    6363    caca_get_event(dp, CACA_EVENT_KEY_PRESS,
    64                    &ev, -1);
     64                   NULL, -1);
    6565    /* Clean up library */
    6666    caca_free_display(dp);
  • libcaca/trunk/test/colors.c

    r832 r849  
    2525    cucul_canvas_t *cv;
    2626    caca_display_t *dp;
    27     caca_event_t ev;
    2827    int i, j;
    2928
     
    5251
    5352    caca_refresh_display(dp);
    54     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     53    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    5554
    5655    caca_free_display(dp);
  • libcaca/trunk/test/dithering.c

    r819 r849  
    1313
    1414#include "config.h"
     15
     16#include <stdio.h>
    1517
    1618#include "cucul.h"
     
    3537int main(void)
    3638{
    37     caca_event_t ev;
    3839    cucul_canvas_t *cv;
    3940    caca_display_t *dp;
     
    125126    caca_refresh_display(dp);
    126127
    127     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     128    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    128129
    129130    caca_free_display(dp);
  • libcaca/trunk/test/font.c

    r819 r849  
    3939    cucul_font_t *f;
    4040    cucul_dither_t *d;
    41     caca_event_t ev;
    4241    unsigned char *buf;
    4342    unsigned int w, h;
     
    9897    caca_refresh_display(dp);
    9998
    100     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     99    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    101100
    102101    /* Free everything */
  • libcaca/trunk/test/frames.c

    r843 r849  
    2222#endif
    2323
     24#include <stdio.h>
     25
    2426#include "cucul.h"
    2527#include "caca.h"
     
    2729int main(void)
    2830{
    29     caca_event_t ev;
    3031    cucul_canvas_t *cv;
    3132    caca_display_t *dp;
     
    5859
    5960    n = 0;
    60     while(!caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, 0))
     61    while(!caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, 0))
    6162    {
    6263        cucul_set_canvas_frame(cv, n % 16);
  • libcaca/trunk/test/hsv.c

    r819 r849  
    2222#endif
    2323
     24#include <stdio.h>
     25
    2426#include "cucul.h"
    2527#include "caca.h"
     
    2931int main(void)
    3032{
    31     caca_event_t ev;
    3233    cucul_canvas_t *cv;
    3334    caca_display_t *dp;
     
    5354    caca_refresh_display(dp);
    5455
    55     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     56    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    5657
    5758    caca_free_display(dp);
  • libcaca/trunk/test/transform.c

    r819 r849  
    5050int main(void)
    5151{
    52     caca_event_t ev;
    5352    cucul_canvas_t *cv, *normal, *flip, *flop, *rotate;
    5453    caca_display_t *dp;
     
    109108    caca_refresh_display(dp);
    110109
    111     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     110    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    112111
    113112    caca_free_display(dp);
  • libcaca/trunk/test/truecolor.c

    r819 r849  
    2222#endif
    2323
     24#include <stdio.h>
     25
    2426#include "cucul.h"
    2527#include "caca.h"
     
    2729int main(void)
    2830{
    29     caca_event_t ev;
    3031    cucul_canvas_t *cv;
    3132    caca_display_t *dp;
     
    5152    caca_refresh_display(dp);
    5253
    53     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     54    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    5455
    5556    caca_free_display(dp);
  • libcaca/trunk/test/unicode.c

    r819 r849  
    2222#endif
    2323
     24#include <stdio.h>
     25
    2426#include "cucul.h"
    2527#include "caca.h"
     
    2729int main(void)
    2830{
    29     caca_event_t ev;
    3031    cucul_canvas_t *cv;
    3132    caca_display_t *dp;
     
    8889    caca_refresh_display(dp);
    8990
    90     caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1);
     91    caca_get_event(dp, CACA_EVENT_KEY_PRESS, NULL, -1);
    9192
    9293    caca_free_display(dp);
Note: See TracChangeset for help on using the changeset viewer.