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:
committed by
Daniel Stone
parent
96e32805d1
commit
738d2e8817
@@ -373,26 +373,6 @@ LinuxEnable (void)
|
||||
enabled = TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
LinuxSpecialKey (KeySym sym)
|
||||
{
|
||||
struct vt_stat vts;
|
||||
int con;
|
||||
|
||||
if (XK_F1 <= sym && sym <= XK_F12)
|
||||
{
|
||||
con = sym - XK_F1 + 1;
|
||||
memset (&vts, '\0', sizeof (vts)); /* valgrind */
|
||||
ioctl (LinuxConsoleFd, VT_GETSTATE, &vts);
|
||||
if (con != vts.v_active && (vts.v_state & (1 << con)))
|
||||
{
|
||||
ioctl (LinuxConsoleFd, VT_ACTIVATE, con);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
LinuxDisable (void)
|
||||
{
|
||||
@@ -481,13 +461,20 @@ KdOsAddInputDrivers ()
|
||||
KdAddKeyboardDriver(&LinuxKeyboardDriver);
|
||||
}
|
||||
|
||||
static void
|
||||
LinuxBell(int volume, int pitch, int duration)
|
||||
{
|
||||
if (volume && pitch)
|
||||
ioctl(LinuxConsoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff) |
|
||||
(((unsigned long)duration * volume / 50) << 16));
|
||||
}
|
||||
|
||||
KdOsFuncs LinuxFuncs = {
|
||||
LinuxInit,
|
||||
LinuxEnable,
|
||||
LinuxSpecialKey,
|
||||
LinuxDisable,
|
||||
LinuxFini,
|
||||
0
|
||||
.Init = LinuxInit,
|
||||
.Enable = LinuxEnable,
|
||||
.Disable = LinuxDisable,
|
||||
.Fini = LinuxFini,
|
||||
.Bell = LinuxBell,
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user