Commit | Line | Data |
---|---|---|
a09e091a JB |
1 | /* |
2 | * Copyright 1993 by David Wexelblat <dwex@XFree86.org> | |
3 | * | |
4 | * Permission to use, copy, modify, distribute, and sell this software and its | |
5 | * documentation for any purpose is hereby granted without fee, provided that | |
6 | * the above copyright notice appear in all copies and that both that | |
7 | * copyright notice and this permission notice appear in supporting | |
8 | * documentation, and that the name of David Wexelblat not be used in | |
9 | * advertising or publicity pertaining to distribution of the software without | |
10 | * specific, written prior permission. David Wexelblat makes no representations | |
11 | * about the suitability of this software for any purpose. It is provided | |
12 | * "as is" without express or implied warranty. | |
13 | * | |
14 | * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO | |
16 | * EVENT SHALL DAVID WEXELBLAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR | |
17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, | |
18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
20 | * PERFORMANCE OF THIS SOFTWARE. | |
21 | * | |
22 | */ | |
23 | ||
24 | #ifdef HAVE_XORG_CONFIG_H | |
25 | #include <xorg-config.h> | |
26 | #endif | |
27 | ||
28 | #include <X11/X.h> | |
29 | ||
30 | #include "xf86.h" | |
31 | #include "xf86Priv.h" | |
32 | #include "xf86_OSlib.h" | |
33 | ||
34 | /* | |
35 | * Handle the VT-switching interface for OSs that use USL-style ioctl()s | |
36 | * (the sysv, sco, and linux subdirs). | |
37 | */ | |
38 | ||
39 | /* | |
40 | * This function is the signal handler for the VT-switching signal. It | |
41 | * is only referenced inside the OS-support layer. | |
42 | */ | |
43 | void | |
44 | xf86VTRequest(int sig) | |
45 | { | |
46 | signal(sig, (void (*)(int)) xf86VTRequest); | |
47 | xf86Info.vtRequestsPending = TRUE; | |
48 | return; | |
49 | } | |
50 | ||
51 | Bool | |
52 | xf86VTSwitchPending(void) | |
53 | { | |
54 | return xf86Info.vtRequestsPending ? TRUE : FALSE; | |
55 | } | |
56 | ||
57 | Bool | |
58 | xf86VTSwitchAway(void) | |
59 | { | |
60 | xf86Info.vtRequestsPending = FALSE; | |
61 | if (ioctl(xf86Info.consoleFd, VT_RELDISP, 1) < 0) | |
62 | return FALSE; | |
63 | else | |
64 | return TRUE; | |
65 | } | |
66 | ||
67 | Bool | |
68 | xf86VTSwitchTo(void) | |
69 | { | |
70 | xf86Info.vtRequestsPending = FALSE; | |
71 | if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) | |
72 | return FALSE; | |
73 | else | |
74 | return TRUE; | |
75 | } | |
76 | ||
77 | Bool | |
78 | xf86VTActivate(int vtno) | |
79 | { | |
80 | #ifdef VT_ACTIVATE | |
81 | if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) { | |
82 | return FALSE; | |
83 | } | |
84 | #endif | |
85 | return TRUE; | |
86 | } |