1/* $Xorg: sunIo.c,v 1.4 2001/03/07 17:34:19 pookie Exp $ */
2/*-
3 * sunIo.c --
4 *	Functions to handle input from the keyboard and mouse.
5 *
6 * Copyright 1987 by the Regents of the University of California
7 *
8 * Permission to use, copy, modify, and distribute this
9 * software and its documentation for any purpose and without
10 * fee is hereby granted, provided that the above copyright
11 * notice appear in all copies.  The University of California
12 * makes no representations about the suitability of this
13 * software for any purpose.  It is provided "as is" without
14 * express or implied warranty.
15 *
16 *
17 */
18/* $XFree86: xc/programs/Xserver/hw/sun/sunIo.c,v 3.10 2003/11/17 22:20:36 dawes Exp $ */
19
20/************************************************************
21Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
22
23                    All Rights Reserved
24
25Permission  to  use,  copy,  modify,  and  distribute   this
26software  and  its documentation for any purpose and without
27fee is hereby granted, provided that the above copyright no-
28tice  appear  in all copies and that both that copyright no-
29tice and this permission notice appear in  supporting  docu-
30mentation,  and  that the names of Sun or The Open Group
31not be used in advertising or publicity pertaining to
32distribution  of  the software  without specific prior
33written permission. Sun and The Open Group make no
34representations about the suitability of this software for
35any purpose. It is provided "as is" without any express or
36implied warranty.
37
38SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
39INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
40NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
41ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
43PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
44OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
45THE USE OR PERFORMANCE OF THIS SOFTWARE.
46
47********************************************************/
48
49#define NEED_EVENTS
50#include    "sun.h"
51#include    "mi.h"
52#include    "os.h"
53
54/*-
55 *-----------------------------------------------------------------------
56 * ProcessInputEvents --
57 *	Retrieve all waiting input events and pass them to DIX in their
58 *	correct chronological order. Only reads from the system pointer
59 *	and keyboard.
60 *
61 * Results:
62 *	None.
63 *
64 * Side Effects:
65 *	Events are passed to the DIX layer.
66 *
67 *-----------------------------------------------------------------------
68 */
69void
70ProcessInputEvents(void)
71{
72    mieqProcessInputEvents ();
73}
74
75#if INPUTTHREAD
76/** This function is called in Xserver/os/inputthread.c when starting
77    the input thread. */
78void
79ddxInputThreadInit(void)
80{
81}
82#endif
83
84/* Called by AbortServer(). */
85void
86ddxGiveUp(enum ExitCode error)
87{
88    int		i;
89    ScreenPtr	pScreen;
90
91#if defined(SVR4) || defined(CSRG_BASED)
92    sunNonBlockConsoleOff ();
93#else
94    sunNonBlockConsoleOff (NULL);
95#endif
96    for (i = 0; i < screenInfo.numScreens; i++)
97    {
98	pScreen = screenInfo.screens[i];
99	(*pScreen->SaveScreen) (pScreen, SCREEN_SAVER_OFF);
100#if 0	/* XXX GX is disabled for now */
101	sunDisableCursor (pScreen);
102#endif
103    }
104    LogClose(error);
105}
106
107int
108ddxProcessArgument(int argc, char *argv[], int i)
109{
110
111    if (strcmp (argv[i], "-swapLkeys") == 0) {	/* -swapLkeys */
112	sunSwapLkeys = TRUE;
113	return 1;
114    }
115    if (strcmp (argv[i], "-debug") == 0) {	/* -debug */
116	sunDebug = TRUE;
117	return 1;
118    }
119    if (strcmp (argv[i], "-dev") == 0) {	/* -dev /dev/mumble */
120	if (++i >= argc)
121	    UseMsg();
122	sunDeviceList = argv[i];
123	return 2;
124    }
125    if (strcmp (argv[i], "-mono") == 0) {	/* -mono */
126	sunForceMono = TRUE;
127	return 1;
128    }
129    if (strcmp (argv[i], "-zaphod") == 0) {	/* -zaphod */
130	sunActiveZaphod = FALSE;
131	return 1;
132    }
133    if (strcmp (argv[i], "-flipPixels") == 0) {	/* -flipPixels */
134	sunFlipPixels = TRUE;
135	return 1;
136    }
137    if (strcmp (argv[i], "-fbinfo") == 0) {	/* -fbinfo */
138	sunFbInfo = TRUE;
139	return 1;
140    }
141    if (strcmp (argv[i], "-cg4frob") == 0) {
142	sunCG4Frob = TRUE;
143	return 1;
144    }
145    if (strcmp (argv[i], "-noGX") == 0) {
146	sunNoGX = TRUE;
147	return 1;
148    }
149    return 0;
150}
151
152void
153ddxUseMsg(void)
154{
155    ErrorF("-swapLkeys          swap keysyms on L1..L10\n");
156    ErrorF("-debug              disable non-blocking console mode\n");
157    ErrorF("-dev fn[:fn][:fn]   name of device[s] to open\n");
158    ErrorF("-mono               force monochrome-only screen\n");
159    ErrorF("-zaphod             disable active Zaphod mode\n");
160    ErrorF("-fbinfo             tell more about the found frame buffer(s)\n");
161#ifdef UNDOCUMENTED
162    ErrorF("-cg4frob            don't use the mono plane of the cgfour\n");
163    ErrorF("-noGX               treat the GX as a dumb frame buffer\n");
164#endif
165}
166