dmxinput.c revision 706f2543
1706f2543Smrg/*
2706f2543Smrg * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
3706f2543Smrg *
4706f2543Smrg * All Rights Reserved.
5706f2543Smrg *
6706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining
7706f2543Smrg * a copy of this software and associated documentation files (the
8706f2543Smrg * "Software"), to deal in the Software without restriction, including
9706f2543Smrg * without limitation on the rights to use, copy, modify, merge,
10706f2543Smrg * publish, distribute, sublicense, and/or sell copies of the Software,
11706f2543Smrg * and to permit persons to whom the Software is furnished to do so,
12706f2543Smrg * subject to the following conditions:
13706f2543Smrg *
14706f2543Smrg * The above copyright notice and this permission notice (including the
15706f2543Smrg * next paragraph) shall be included in all copies or substantial
16706f2543Smrg * portions of the Software.
17706f2543Smrg *
18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19706f2543Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21706f2543Smrg * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22706f2543Smrg * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23706f2543Smrg * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24706f2543Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25706f2543Smrg * SOFTWARE.
26706f2543Smrg */
27706f2543Smrg
28706f2543Smrg/*
29706f2543Smrg * Authors:
30706f2543Smrg *   David H. Dawes <dawes@xfree86.org>
31706f2543Smrg *   Kevin E. Martin <kem@redhat.com>
32706f2543Smrg *   Rickard E. (Rik) Faith <faith@redhat.com>
33706f2543Smrg *
34706f2543Smrg */
35706f2543Smrg
36706f2543Smrg/** \file
37706f2543Smrg * Provide the main entry points for input initialization and processing
38706f2543Smrg * that arequired by the dix layer.
39706f2543Smrg */
40706f2543Smrg
41706f2543Smrg#ifdef HAVE_DMX_CONFIG_H
42706f2543Smrg#include <dmx-config.h>
43706f2543Smrg#endif
44706f2543Smrg
45706f2543Smrg#include "dmx.h"
46706f2543Smrg#include "dmxlog.h"
47706f2543Smrg#include "dmxinput.h"
48706f2543Smrg
49706f2543Smrg#include "inputstr.h"
50706f2543Smrg#include "input.h"
51706f2543Smrg#include "mi.h"
52706f2543Smrg
53706f2543Smrg/** Returns TRUE if the key is a valid modifier.  For PC-class
54706f2543Smrg * keyboards, all keys can be used as modifiers, so return TRUE
55706f2543Smrg * always. */
56706f2543SmrgBool LegalModifier(unsigned int key, DeviceIntPtr pDev)
57706f2543Smrg{
58706f2543Smrg    return TRUE;
59706f2543Smrg}
60706f2543Smrg
61706f2543Smrg/** Called from dix/main.c on each server generation to initialize
62706f2543Smrg * inputs.  All the work is done in dmxInputInit.  \see
63706f2543Smrg * dmxInputInit() */
64706f2543Smrgvoid InitInput(int argc, char **argv)
65706f2543Smrg{
66706f2543Smrg    int          i;
67706f2543Smrg    DMXInputInfo *dmxInput;
68706f2543Smrg
69706f2543Smrg    if (!dmxNumInputs)
70706f2543Smrg        dmxLog(dmxFatal, "InitInput: no inputs specified\n");
71706f2543Smrg
72706f2543Smrg    for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
73706f2543Smrg        dmxInputInit(dmxInput);
74706f2543Smrg
75706f2543Smrg    mieqInit();
76706f2543Smrg}
77706f2543Smrg
78706f2543Smrgvoid CloseInput(void)
79706f2543Smrg{
80706f2543Smrg}
81706f2543Smrg
82706f2543Smrg/** Called from dix/dispatch.c in Dispatch() whenever input events
83706f2543Smrg * require processing.  All the work is done in the lower level
84706f2543Smrg * routines. */
85706f2543Smrgvoid ProcessInputEvents(void)
86706f2543Smrg{
87706f2543Smrg    int          i;
88706f2543Smrg    DMXInputInfo *dmxInput;
89706f2543Smrg
90706f2543Smrg    for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
91706f2543Smrg        if (!dmxInput->detached && dmxInput->processInputEvents)
92706f2543Smrg            dmxInput->processInputEvents(dmxInput);
93706f2543Smrg}
94706f2543Smrg
95706f2543Smrg/** This routine is called from \a dmxwindow.c whenever the layout of
96706f2543Smrg * windows on the display might have changed.  This information is used
97706f2543Smrg * by input drivers (currently only the console driver) that provide
98706f2543Smrg * information about window layout to the user. */
99706f2543Smrgvoid dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
100706f2543Smrg{
101706f2543Smrg    int          i;
102706f2543Smrg    DMXInputInfo *dmxInput;
103706f2543Smrg
104706f2543Smrg    for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
105706f2543Smrg        if (!dmxInput->detached && dmxInput->updateWindowInfo)
106706f2543Smrg            dmxInput->updateWindowInfo(dmxInput, type, pWindow);
107706f2543Smrg}
108706f2543Smrg
109706f2543Smrgint
110706f2543SmrgNewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
111706f2543Smrg                       DeviceIntPtr *pdev)
112706f2543Smrg{
113706f2543Smrg    return BadRequest;
114706f2543Smrg}
115706f2543Smrg
116706f2543Smrgvoid
117706f2543SmrgDeleteInputDeviceRequest(DeviceIntPtr pDev)
118706f2543Smrg{
119706f2543Smrg}
120