diff --git a/hw/xfree86/os-support/bsd/bsd_VTsw.c b/hw/xfree86/os-support/bsd/bsd_VTsw.c index faf7f96fac..531d2d8d28 100644 --- a/hw/xfree86/os-support/bsd/bsd_VTsw.c +++ b/hw/xfree86/os-support/bsd/bsd_VTsw.c @@ -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) { diff --git a/hw/xfree86/os-support/bsd/console.c b/hw/xfree86/os-support/bsd/console.c index 0631986d4a..a65913ab26 100644 --- a/hw/xfree86/os-support/bsd/console.c +++ b/hw/xfree86/os-support/bsd/console.c @@ -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; +} diff --git a/hw/xfree86/os-support/bsd/console_pcvt.c b/hw/xfree86/os-support/bsd/console_pcvt.c index f15685033b..1df39c0b26 100644 --- a/hw/xfree86/os-support/bsd/console_pcvt.c +++ b/hw/xfree86/os-support/bsd/console_pcvt.c @@ -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); } diff --git a/hw/xfree86/os-support/bsd/console_syscons.c b/hw/xfree86/os-support/bsd/console_syscons.c index 25932ff047..b98335bd01 100644 --- a/hw/xfree86/os-support/bsd/console_syscons.c +++ b/hw/xfree86/os-support/bsd/console_syscons.c @@ -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); }