2
* (c) Copyright 1998 by Sebastien Marineau
5
* Permission is hereby granted, free of charge, to any person obtaining a
6
* copy of this software and associated documentation files (the "Software"),
7
* to deal in the Software without restriction, including without limitation
8
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
* and/or sell copies of the Software, and to permit persons to whom the
10
* Software is furnished to do so, subject to the following conditions:
12
* The above copyright notice and this permission notice shall be included in
13
* all copies or substantial portions of the Software.
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
* Except as contained in this notice, the name of Sebastien Marineau shall not
24
* used in advertising or otherwise to promote the sale, use or other dealings
25
* in this Software without prior written authorization from Sebastien Marineau.
27
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c,v 1.1 1999/12/27 00:45:47 robin Exp $
30
/* This module contains the code to use _select_receive to handle
31
* messages from the Mouse and Input driver. These cannot be select'ed on.
34
/* This module contains the functions which are used to do
35
* VT switching to a text console and back... Experimental.
39
#include "scrnintstr.h"
43
#include "xf86_OSlib.h"
45
#include <sys/console.h>
47
int QNX_console_exist[10];
48
Bool QNX_vtswitch_pending = FALSE;
49
int QNX_con_toactivate = -1;
50
extern struct _console_ctrl *QNX_con_ctrl;
51
extern unsigned QNX_con_mask, QNX_con_bits;
52
extern pid_t QNX_console_proxy;
53
extern int QNX_our_console;
55
/* This gets called to determine if a VT switch has been requested */
56
Bool xf86VTSwitchPending()
58
return(xf86Info.vtRequestsPending ? TRUE : FALSE);
61
/* This is called to do OS-specific stuff when we switch away from
64
Bool xf86VTSwitchAway()
69
ErrorF("Called VT switch away!\n");
71
/* First check wether we are trying to switch to our console... */
72
if (xf86Info.vtRequestsPending == QNX_our_console) {
73
xf86Info.vtRequestsPending = FALSE;
77
/* Reenable console switching */
78
QNX_con_bits &= ~QNX_con_mask;
79
bits = console_ctrl(QNX_con_ctrl, -1, QNX_con_bits, QNX_con_mask);
82
/* And activate the new console. Check if it is valid first... */
83
ret = console_active(QNX_con_ctrl, xf86Info.vtRequestsPending);
84
ErrorF("xf86VTSwitchAway: Made console %d active, ret %d\n",
85
xf86Info.vtRequestsPending, ret);
86
xf86Info.vtRequestsPending = FALSE;
89
QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
90
QNX_con_bits = console_ctrl (QNX_con_ctrl,
91
QNX_our_console, QNX_con_mask, QNX_con_mask);
94
/* Arm the console with the proxy so we know when we come back */
95
console_state(QNX_con_ctrl, QNX_our_console, 0L, _CON_EVENT_ACTIVE);
96
event = _CON_EVENT_ACTIVE;
97
console_arm (QNX_con_ctrl, QNX_our_console, QNX_console_proxy, event);
102
/* And this is called when we are switching back to the server */
103
Bool xf86VTSwitchTo()
107
ErrorF("Called VT switch to the server!\n");
108
QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
109
QNX_con_bits = console_ctrl (QNX_con_ctrl, QNX_our_console, QNX_con_mask, QNX_con_mask);
110
xf86Info.vtRequestsPending = FALSE;