kdrive: move bell ringing into an OS function

Move the bell into an OS function, and use that if it's declared; else,
fall back to using the driver's function.
Remove the Linux keyboard bell function; just move it into the OS layer.
Use named initialisers when converting the old structures, and eliminate
unused functions.
This commit is contained in:
Daniel Stone
2006-10-29 03:48:02 +03:00
committed by Daniel Stone
parent 96e32805d1
commit 738d2e8817
6 changed files with 52 additions and 116 deletions

View File

@@ -523,22 +523,46 @@ LegalModifier(unsigned int key, DeviceIntPtr pDev)
}
static void
KdBell (int volume, DeviceIntPtr pDev, pointer ctrl, int something)
KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something)
{
KeybdCtrl *ctrl = arg;
KdKeyboardInfo *ki = NULL;
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev && (ki->dixdev->id == pDev->id))
if (ki->dixdev && ki->dixdev->id == pDev->id)
break;
}
if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver)
return;
if (kdInputEnabled) {
if (ki->driver->Bell)
(*ki->driver->Bell) (ki, volume, ki->bellPitch, ki->bellDuration);
KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration);
}
void
DDXRingBell(int volume, int pitch, int duration)
{
KdKeyboardInfo *ki = NULL;
if (kdOsFuncs->Bell) {
(*kdOsFuncs->Bell)(volume, pitch, duration);
}
else {
for (ki = kdKeyboards; ki; ki = ki->next) {
if (ki->dixdev->coreEvents)
KdRingBell(ki, volume, pitch, duration);
}
}
}
void
KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration)
{
if (!ki || !ki->driver || !ki->driver->Bell)
return;
if (kdInputEnabled)
(*ki->driver->Bell) (ki, volume, pitch, duration);
}