mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
xfree86: os-support: bsd: factor out switch away from VT handling
Factor it out to separate per-console-driver functions. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
4c2c8a2fcd
commit
ce3e1aa388
@@ -62,21 +62,6 @@ xf86VTSwitchPending(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86VTSwitchAway(void)
|
||||
{
|
||||
#if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
|
||||
if (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT) {
|
||||
xf86Info.vtRequestsPending = FALSE;
|
||||
if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
xf86VTSwitchTo(void)
|
||||
{
|
||||
|
||||
@@ -12,3 +12,11 @@ void xf86OSRingBell(int loudness, int pitch, int duration)
|
||||
if (xf86_console_proc_bell)
|
||||
xf86_console_proc_bell(loudness, pitch, duration);
|
||||
}
|
||||
|
||||
Bool xf86VTSwitchAway(void)
|
||||
{
|
||||
if (xf86_console_proc_switch_away)
|
||||
if (xf86_console_proc_switch_away())
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ static void xf86_console_pcvt_bell(int loudness, int pitch, int duration)
|
||||
}
|
||||
}
|
||||
|
||||
static bool xf86_console_pcvt_switch_away(void)
|
||||
{
|
||||
xf86Info.vtRequestsPending = FALSE;
|
||||
return (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) >= 0);
|
||||
}
|
||||
|
||||
bool xf86_console_pcvt_open(void)
|
||||
{
|
||||
/* This looks much like syscons, since pcvt is API compatible */
|
||||
@@ -185,6 +191,7 @@ out:
|
||||
xf86_console_proc_bell = xf86_console_pcvt_bell;
|
||||
xf86_console_proc_close = xf86_console_pcvt_close;
|
||||
xf86_console_proc_reactivate = xf86_console_pcvt_reactivate;
|
||||
xf86_console_proc_switch_away = xf86_console_pcvt_switch_away;
|
||||
return (fd > 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,12 @@ static void xf86_console_syscons_bell(int loudness, int pitch, int duration)
|
||||
}
|
||||
}
|
||||
|
||||
static bool xf86_console_syscons_switch_away(void)
|
||||
{
|
||||
xf86Info.vtRequestsPending = FALSE;
|
||||
return (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) >= 0);
|
||||
}
|
||||
|
||||
/* The FreeBSD 1.1 version syscons driver uses /dev/ttyv0 */
|
||||
#define SYSCONS_CONSOLE_DEV1 "/dev/ttyv0"
|
||||
#define SYSCONS_CONSOLE_DEV2 "/dev/vga"
|
||||
@@ -157,6 +163,7 @@ bool xf86_console_syscons_open(void)
|
||||
xf86_console_proc_bell = xf86_console_syscons_bell;
|
||||
xf86_console_proc_close = xf86_console_syscons_close;
|
||||
xf86_console_proc_reactivate = xf86_console_syscons_reactivate;
|
||||
xf86_console_proc_switch_away = xf86_console_syscons_switch_away;
|
||||
return (fd > 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user