Changeset 337


Ignore:
Timestamp:
Jan 11, 2004, 7:09:01 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • configure.ac src/time.c: + Look for Sleep in -lkernel32.
  • examples/cacaview.c: + Use caca_wait_event() instead of usleep()/caca_get_event().
Location:
libcaca/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/configure.ac

    r335 r337  
    3030
    3131AC_CHECK_HEADERS(inttypes.h endian.h)
    32 AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp usleep Sleep gettimeofday)
     32AC_CHECK_FUNCS(vsnprintf getenv putenv strcasecmp usleep gettimeofday)
     33case "${target_os}" in
     34  *mingw32*|*cygwin*)
     35    AC_CHECK_LIB(kernel32, Sleep,
     36                 [AC_DEFINE(HAVE_KERNEL32_SLEEP, 1, [Define if you have Windows' Sleep])])
     37    ;;
     38esac
    3339AC_CHECK_LIB(m, sin, MATH_LIBS="${MATH_LIBS} -lm")
    3440
  • libcaca/trunk/examples/cacaview.c

    r336 r337  
    115115        unsigned int event, new_status = 0, new_help = 0;
    116116
    117         while((event = caca_get_event(CACA_EVENT_KEY_PRESS)))
     117        if(update)
     118            event = caca_get_event(CACA_EVENT_KEY_PRESS);
     119        else
     120            event = caca_wait_event(CACA_EVENT_KEY_PRESS);
     121
     122        while(event)
    118123        {
    119124            unsigned int key = event & 0x00ffffff;
     
    230235            if(help || new_help)
    231236                help = new_help;
     237
     238            event = caca_get_event(CACA_EVENT_KEY_PRESS);
    232239        }
    233240
     
    257264
    258265            free(buffer);
    259         }
    260 
    261         if(!update)
    262         {
    263 #if defined(HAVE_USLEEP)
    264             usleep(10000);
    265 #elif defined(HAVE_SLEEP)
    266             Sleep(10);
    267 #endif
    268             continue;
    269266        }
    270267
  • libcaca/trunk/src/time.c

    r336 r337  
    4747#if defined(HAVE_USLEEP)
    4848        usleep(usec);
    49 #elif defined(HAVE_SLEEP)
     49#elif defined(HAVE_KERNEL32_SLEEP)
    5050        Sleep(usec / 1000);
    5151#else
Note: See TracChangeset for help on using the changeset viewer.