mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 12:03:03 -05:00
Fix de Bath's last-ditch bell overload
[originally from svn r1100]
This commit is contained in:
parent
c1c1bc4715
commit
19b6dcc1ae
11
window.c
11
window.c
@ -3027,14 +3027,17 @@ void beep(int mode)
|
|||||||
* active one. So we limit the rate to one per 50ms or so.
|
* active one. So we limit the rate to one per 50ms or so.
|
||||||
*/
|
*/
|
||||||
static long lastbeep = 0;
|
static long lastbeep = 0;
|
||||||
long now, beepdiff;
|
long beepdiff;
|
||||||
|
|
||||||
now = GetTickCount();
|
beepdiff = GetTickCount() - lastbeep;
|
||||||
beepdiff = now - lastbeep;
|
|
||||||
if (beepdiff >= 0 && beepdiff < 50)
|
if (beepdiff >= 0 && beepdiff < 50)
|
||||||
return;
|
return;
|
||||||
MessageBeep(MB_OK);
|
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) {
|
} else if (mode == BELL_WAVEFILE) {
|
||||||
if (!PlaySound(cfg.bell_wavefile, NULL, SND_ASYNC | SND_FILENAME)) {
|
if (!PlaySound(cfg.bell_wavefile, NULL, SND_ASYNC | SND_FILENAME)) {
|
||||||
char buf[sizeof(cfg.bell_wavefile) + 80];
|
char buf[sizeof(cfg.bell_wavefile) + 80];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user