From d51cdf1ec35ccb54cf20edfdf1a0b6e3f2044a9b Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 6 May 2001 16:18:58 +0000 Subject: [PATCH] Fix de Bath's last-ditch bell overload git-svn-id: svn://svn.tartarus.org/sgt/putty@1100 cda61777-01e9-0310-a592-d414129be87e --- window.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/window.c b/window.c index 3c67ddf4..6eeac941 100644 --- a/window.c +++ b/window.c @@ -3027,14 +3027,17 @@ void beep(int mode) * active one. So we limit the rate to one per 50ms or so. */ static long lastbeep = 0; - long now, beepdiff; + long beepdiff; - now = GetTickCount(); - beepdiff = now - lastbeep; + beepdiff = GetTickCount() - lastbeep; if (beepdiff >= 0 && beepdiff < 50) return; MessageBeep(MB_OK); - lastbeep = now; + /* + * The above MessageBeep call takes time, so we record the + * time _after_ it finishes rather than before it starts. + */ + lastbeep = GetTickCount(); } else if (mode == BELL_WAVEFILE) { if (!PlaySound(cfg.bell_wavefile, NULL, SND_ASYNC | SND_FILENAME)) { char buf[sizeof(cfg.bell_wavefile) + 80]; -- 2.11.0