diff options
Diffstat (limited to 'xc/programs/Xserver/xkb/ddxBeep.c')
-rw-r--r-- | xc/programs/Xserver/xkb/ddxBeep.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/xc/programs/Xserver/xkb/ddxBeep.c b/xc/programs/Xserver/xkb/ddxBeep.c index 538e321c3..3f8006183 100644 --- a/xc/programs/Xserver/xkb/ddxBeep.c +++ b/xc/programs/Xserver/xkb/ddxBeep.c @@ -1,4 +1,4 @@ -/* $TOG: ddxBeep.c /main/5 1997/06/10 06:53:42 kaleb $ */ +/* $Xorg: ddxBeep.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxBeep.c,v 3.6 2002/10/21 13:33:05 alanh Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -59,7 +60,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define HIGH_PITCH 2000 #define CLICK_PITCH 1500 -static unsigned long atomGeneration= -1; +static unsigned long atomGeneration= 0; static Atom featureOn; static Atom featureOff; static Atom featureChange; @@ -138,6 +139,10 @@ _XkbDDXBeepInitAtoms() (strcmp(keyboard,"LK443") == 0)) doesPitch = 0; } +#else +#if defined(sun) + doesPitch = 0; +#endif #endif return; } @@ -318,6 +323,9 @@ Atom name; break; } if (duration>0) { + CARD32 starttime = GetTimeInMillis(); + CARD32 elapsedtime; + ctrl->bell_duration= duration; ctrl->bell_pitch= pitch; if (xkbInfo->beepCount==0) { @@ -330,6 +338,23 @@ Atom name; ctrl->bell_duration= oldDuration; ctrl->bell_pitch= oldPitch; xkbInfo->beepCount++; + + /* Some DDX schedule the beep and return immediately, others don't + return until the beep is completed. We measure the time and if + it's less than the beep duration, make sure not to schedule the + next beep until after the current one finishes. */ + + elapsedtime = GetTimeInMillis(); + if (elapsedtime > starttime) { /* watch out for millisecond counter + overflow! */ + elapsedtime -= starttime; + } else { + elapsedtime = 0; + } + if (elapsedtime < duration) { + next += duration - elapsedtime; + } + } return next; } |