diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
commit | d568221710959cf7d783e6ff0fb80fb43a231124 (patch) | |
tree | 8d6f039393294c6ffac8533639afdebe5d68bfc1 /xkb/ddxBeep.c | |
parent | 9508a382f8a9f241dab097d921b6d290c1c3a776 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
Diffstat (limited to 'xkb/ddxBeep.c')
-rw-r--r-- | xkb/ddxBeep.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/xkb/ddxBeep.c b/xkb/ddxBeep.c index 3f3ae57a0..74352161c 100644 --- a/xkb/ddxBeep.c +++ b/xkb/ddxBeep.c @@ -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.9 2002/12/05 21:59:00 paulo 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; } @@ -317,7 +322,10 @@ Atom name; next = SHORT_DELAY; break; } - if (duration>0) { + if (timer == NULL && 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; } |