xref: /OK3568_Linux_fs/external/xserver/hw/dmx/dmxinput.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * All Rights Reserved.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Permission is hereby granted, free of charge, to any person obtaining
7*4882a593Smuzhiyun  * a copy of this software and associated documentation files (the
8*4882a593Smuzhiyun  * "Software"), to deal in the Software without restriction, including
9*4882a593Smuzhiyun  * without limitation on the rights to use, copy, modify, merge,
10*4882a593Smuzhiyun  * publish, distribute, sublicense, and/or sell copies of the Software,
11*4882a593Smuzhiyun  * and to permit persons to whom the Software is furnished to do so,
12*4882a593Smuzhiyun  * subject to the following conditions:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * The above copyright notice and this permission notice (including the
15*4882a593Smuzhiyun  * next paragraph) shall be included in all copies or substantial
16*4882a593Smuzhiyun  * portions of the Software.
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19*4882a593Smuzhiyun  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20*4882a593Smuzhiyun  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21*4882a593Smuzhiyun  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22*4882a593Smuzhiyun  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23*4882a593Smuzhiyun  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24*4882a593Smuzhiyun  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25*4882a593Smuzhiyun  * SOFTWARE.
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /*
29*4882a593Smuzhiyun  * Authors:
30*4882a593Smuzhiyun  *   David H. Dawes <dawes@xfree86.org>
31*4882a593Smuzhiyun  *   Kevin E. Martin <kem@redhat.com>
32*4882a593Smuzhiyun  *   Rickard E. (Rik) Faith <faith@redhat.com>
33*4882a593Smuzhiyun  *
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun /** \file
37*4882a593Smuzhiyun  * Provide the main entry points for input initialization and processing
38*4882a593Smuzhiyun  * that arequired by the dix layer.
39*4882a593Smuzhiyun  */
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun #ifdef HAVE_DMX_CONFIG_H
42*4882a593Smuzhiyun #include <dmx-config.h>
43*4882a593Smuzhiyun #endif
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #include "dmx.h"
46*4882a593Smuzhiyun #include "dmxlog.h"
47*4882a593Smuzhiyun #include "dmxinput.h"
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #include "inputstr.h"
50*4882a593Smuzhiyun #include "input.h"
51*4882a593Smuzhiyun #include "mi.h"
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun /** Returns TRUE if the key is a valid modifier.  For PC-class
54*4882a593Smuzhiyun  * keyboards, all keys can be used as modifiers, so return TRUE
55*4882a593Smuzhiyun  * always. */
56*4882a593Smuzhiyun Bool
LegalModifier(unsigned int key,DeviceIntPtr pDev)57*4882a593Smuzhiyun LegalModifier(unsigned int key, DeviceIntPtr pDev)
58*4882a593Smuzhiyun {
59*4882a593Smuzhiyun     return TRUE;
60*4882a593Smuzhiyun }
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun /** Called from dix/main.c on each server generation to initialize
63*4882a593Smuzhiyun  * inputs.  All the work is done in dmxInputInit.  \see
64*4882a593Smuzhiyun  * dmxInputInit() */
65*4882a593Smuzhiyun void
InitInput(int argc,char ** argv)66*4882a593Smuzhiyun InitInput(int argc, char **argv)
67*4882a593Smuzhiyun {
68*4882a593Smuzhiyun     int i;
69*4882a593Smuzhiyun     DMXInputInfo *dmxInput;
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun     if (!dmxNumInputs)
72*4882a593Smuzhiyun         dmxLog(dmxFatal, "InitInput: no inputs specified\n");
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun     for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
75*4882a593Smuzhiyun         dmxInputInit(dmxInput);
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun     mieqInit();
78*4882a593Smuzhiyun }
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun void
CloseInput(void)81*4882a593Smuzhiyun CloseInput(void)
82*4882a593Smuzhiyun {
83*4882a593Smuzhiyun     mieqFini();
84*4882a593Smuzhiyun }
85*4882a593Smuzhiyun 
86*4882a593Smuzhiyun /** Called from dix/dispatch.c in Dispatch() whenever input events
87*4882a593Smuzhiyun  * require processing.  All the work is done in the lower level
88*4882a593Smuzhiyun  * routines. */
89*4882a593Smuzhiyun void
ProcessInputEvents(void)90*4882a593Smuzhiyun ProcessInputEvents(void)
91*4882a593Smuzhiyun {
92*4882a593Smuzhiyun     int i;
93*4882a593Smuzhiyun     DMXInputInfo *dmxInput;
94*4882a593Smuzhiyun 
95*4882a593Smuzhiyun     for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
96*4882a593Smuzhiyun         if (!dmxInput->detached && dmxInput->processInputEvents)
97*4882a593Smuzhiyun             dmxInput->processInputEvents(dmxInput);
98*4882a593Smuzhiyun }
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun /** This routine is called from \a dmxwindow.c whenever the layout of
101*4882a593Smuzhiyun  * windows on the display might have changed.  This information is used
102*4882a593Smuzhiyun  * by input drivers (currently only the console driver) that provide
103*4882a593Smuzhiyun  * information about window layout to the user. */
104*4882a593Smuzhiyun void
dmxUpdateWindowInfo(DMXUpdateType type,WindowPtr pWindow)105*4882a593Smuzhiyun dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
106*4882a593Smuzhiyun {
107*4882a593Smuzhiyun     int i;
108*4882a593Smuzhiyun     DMXInputInfo *dmxInput;
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun     for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
111*4882a593Smuzhiyun         if (!dmxInput->detached && dmxInput->updateWindowInfo)
112*4882a593Smuzhiyun             dmxInput->updateWindowInfo(dmxInput, type, pWindow);
113*4882a593Smuzhiyun }
114*4882a593Smuzhiyun 
115*4882a593Smuzhiyun int
NewInputDeviceRequest(InputOption * options,InputAttributes * attrs,DeviceIntPtr * pdev)116*4882a593Smuzhiyun NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
117*4882a593Smuzhiyun                       DeviceIntPtr *pdev)
118*4882a593Smuzhiyun {
119*4882a593Smuzhiyun     return BadRequest;
120*4882a593Smuzhiyun }
121*4882a593Smuzhiyun 
122*4882a593Smuzhiyun void
DeleteInputDeviceRequest(DeviceIntPtr pDev)123*4882a593Smuzhiyun DeleteInputDeviceRequest(DeviceIntPtr pDev)
124*4882a593Smuzhiyun {
125*4882a593Smuzhiyun }
126*4882a593Smuzhiyun 
127*4882a593Smuzhiyun void
RemoveInputDeviceTraces(const char * config_info)128*4882a593Smuzhiyun RemoveInputDeviceTraces(const char *config_info)
129*4882a593Smuzhiyun {
130*4882a593Smuzhiyun }
131