diff --git a/sdl1/pdcdisp.c b/sdl1/pdcdisp.c index 52b751be..02351b9c 100644 --- a/sdl1/pdcdisp.c +++ b/sdl1/pdcdisp.c @@ -13,7 +13,7 @@ #include "pdcsdl.h" -RCSID("$Id: pdcdisp.c,v 1.29 2007/07/07 05:17:38 wmcbrine Exp $") +RCSID("$Id: pdcdisp.c,v 1.30 2007/07/07 14:48:37 wmcbrine Exp $") #include #include @@ -56,6 +56,8 @@ chtype acs_map[128] = #endif +Uint32 pdc_lastupdate = 0; + #define MAXRECT 200 /* maximum number of rects to queue up before an update is forced; the number was chosen arbitrarily */ @@ -79,6 +81,7 @@ void PDC_update_rects(void) else SDL_UpdateRects(pdc_screen, rectcount, uprect); + pdc_lastupdate = SDL_GetTicks(); rectcount = 0; } } diff --git a/sdl1/pdckbd.c b/sdl1/pdckbd.c index 279c80a3..08279dc3 100644 --- a/sdl1/pdckbd.c +++ b/sdl1/pdckbd.c @@ -13,7 +13,7 @@ #include "pdcsdl.h" -RCSID("$Id: pdckbd.c,v 1.16 2007/06/28 18:41:46 wmcbrine Exp $") +RCSID("$Id: pdckbd.c,v 1.17 2007/07/07 14:48:37 wmcbrine Exp $") /*man-start************************************************************** @@ -119,6 +119,14 @@ void PDC_set_keyboard_binary(bool on) bool PDC_check_key(void) { + Uint32 current = SDL_GetTicks(); + + /* if 30 ms have passed without a screen update, or the timer + has wrapped, update now */ + + if (current < pdc_lastupdate || ((current - pdc_lastupdate) > 30)) + PDC_update_rects(); + return SDL_PollEvent(&event); } diff --git a/sdl1/pdcscrn.c b/sdl1/pdcscrn.c index 7258e0c8..f9d7e70c 100644 --- a/sdl1/pdcscrn.c +++ b/sdl1/pdcscrn.c @@ -13,7 +13,7 @@ #include "pdcsdl.h" -RCSID("$Id: pdcscrn.c,v 1.29 2007/07/07 06:51:31 wmcbrine Exp $") +RCSID("$Id: pdcscrn.c,v 1.30 2007/07/07 14:48:37 wmcbrine Exp $") #include #include "deffont.h" @@ -91,7 +91,7 @@ int PDC_scr_open(int argc, char **argv) if (pdc_own_screen) { - if (SDL_Init(SDL_INIT_VIDEO) < 0) + if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) { fprintf(stderr, "Could not start SDL: %s\n", SDL_GetError()); diff --git a/sdl1/pdcsdl.h b/sdl1/pdcsdl.h index 30b71e85..2602c6df 100644 --- a/sdl1/pdcsdl.h +++ b/sdl1/pdcsdl.h @@ -11,7 +11,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: pdcsdl.h,v 1.13 2007/07/07 05:18:00 wmcbrine Exp $ */ +/* $Id: pdcsdl.h,v 1.14 2007/07/07 14:48:37 wmcbrine Exp $ */ #include @@ -33,6 +33,7 @@ extern bool pdc_own_screen; /* if pdc_screen was not set responsible for (owns) it */ extern WINDOW *pdc_lastscr; /* how curscr looked when last updated -- only blit changes */ +extern Uint32 pdc_lastupdate; /* time of last update, in ticks */ void PDC_update_rects(void); void PDC_retile(void);