1 | /* $XFree86$ */
|
---|
2 | /*
|
---|
3 | * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
|
---|
4 | *
|
---|
5 | * All Rights Reserved.
|
---|
6 | *
|
---|
7 | * Permission is hereby granted, free of charge, to any person obtaining
|
---|
8 | * a copy of this software and associated documentation files (the
|
---|
9 | * "Software"), to deal in the Software without restriction, including
|
---|
10 | * without limitation on the rights to use, copy, modify, merge,
|
---|
11 | * publish, distribute, sublicense, and/or sell copies of the Software,
|
---|
12 | * and to permit persons to whom the Software is furnished to do so,
|
---|
13 | * subject to the following conditions:
|
---|
14 | *
|
---|
15 | * The above copyright notice and this permission notice (including the
|
---|
16 | * next paragraph) shall be included in all copies or substantial
|
---|
17 | * portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
21 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
22 | * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
|
---|
23 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
---|
24 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
25 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
---|
26 | * SOFTWARE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * Authors:
|
---|
31 | * David H. Dawes <[email protected]>
|
---|
32 | * Kevin E. Martin <[email protected]>
|
---|
33 | * Rickard E. (Rik) Faith <[email protected]>
|
---|
34 | *
|
---|
35 | */
|
---|
36 |
|
---|
37 | /** \file
|
---|
38 | * This file provides access to:
|
---|
39 | * - global variables available to all hw/dmx routines, and
|
---|
40 | * - enumerations and typedefs needed by input routines in hw/dmx (and
|
---|
41 | * hw/dmx/input).
|
---|
42 | *
|
---|
43 | * The goal is that no files in hw/dmx should include header files from
|
---|
44 | * hw/dmx/input -- the interface defined here should be the only
|
---|
45 | * interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
|
---|
46 | */
|
---|
47 |
|
---|
48 | #ifndef DMXINPUT_H
|
---|
49 | #define DMXINPUT_H
|
---|
50 |
|
---|
51 | /** Maximum number of file descriptors for SIGIO handling */
|
---|
52 | #define DMX_MAX_SIGIO_FDS 4
|
---|
53 |
|
---|
54 | struct _DMXInputInfo;
|
---|
55 |
|
---|
56 | /** Reason why window layout was updated. */
|
---|
57 | typedef enum {
|
---|
58 | DMX_UPDATE_REALIZE, /**< Window realized */
|
---|
59 | DMX_UPDATE_UNREALIZE, /**< Window unrealized */
|
---|
60 | DMX_UPDATE_RESTACK, /**< Stacking order changed */
|
---|
61 | DMX_UPDATE_COPY, /**< Window copied */
|
---|
62 | DMX_UPDATE_RESIZE, /**< Window resized */
|
---|
63 | DMX_UPDATE_REPARENT /**< Window reparented */
|
---|
64 | } DMXUpdateType;
|
---|
65 |
|
---|
66 | typedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
|
---|
67 | typedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
|
---|
68 | DMXUpdateType, WindowPtr);
|
---|
69 |
|
---|
70 | /** An opaque structure that is only exposed in the dmx/input layer. */
|
---|
71 | typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
|
---|
72 |
|
---|
73 | /** State of the SIGIO engine */
|
---|
74 | typedef enum {
|
---|
75 | DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */
|
---|
76 | DMX_USESIGIO, /**< Device can use SIGIO, but is not
|
---|
77 | * (e.g., because the VT is switch
|
---|
78 | * away). */
|
---|
79 | DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
|
---|
80 | } dmxSigioState;
|
---|
81 |
|
---|
82 | /** DMXInputInfo is typedef'd in #dmx.h so that all routines can have
|
---|
83 | * access to the global pointers. However, the elements are only
|
---|
84 | * available to input-related routines. */
|
---|
85 | struct _DMXInputInfo {
|
---|
86 | const char *name; /**< Name of input display or device
|
---|
87 | * (from command line or config
|
---|
88 | * file) */
|
---|
89 | Bool freename; /**< If true, free name on destroy */
|
---|
90 | Bool detached; /**< If true, input screen is detached */
|
---|
91 | int inputIdx; /**< Index into #dmxInputs global */
|
---|
92 | int scrnIdx; /**< Index into #dmxScreens global */
|
---|
93 | Bool core; /**< If True, initialize these
|
---|
94 | * devices as devices that send core
|
---|
95 | * events */
|
---|
96 | Bool console; /**< True if console and backend
|
---|
97 | * input share the same backend
|
---|
98 | * display */
|
---|
99 |
|
---|
100 | Bool windows; /**< True if window outlines are
|
---|
101 | * draw in console */
|
---|
102 |
|
---|
103 | ProcessInputEventsProc processInputEvents;
|
---|
104 | UpdateWindowInfoProc updateWindowInfo;
|
---|
105 |
|
---|
106 | /* Local input information */
|
---|
107 | dmxSigioState sigioState; /**< Current stat */
|
---|
108 | int sigioFdCount; /**< Number of fds in use */
|
---|
109 | int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
|
---|
110 | Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
|
---|
111 |
|
---|
112 |
|
---|
113 | /** True if a VT switch is pending, but has not yet happened. */
|
---|
114 | int vt_switch_pending;
|
---|
115 |
|
---|
116 | /** True if a VT switch has happened. */
|
---|
117 | int vt_switched;
|
---|
118 |
|
---|
119 | /** Number of devices handled in this _DMXInputInfo structure. */
|
---|
120 | int numDevs;
|
---|
121 |
|
---|
122 | /** List of actual input devices. Each _DMXInputInfo structure can
|
---|
123 | * refer to more than one device. For example, the keyboard and the
|
---|
124 | * pointer of a backend display; or all of the XInput extension
|
---|
125 | * devices on a backend display. */
|
---|
126 | DMXLocalInputInfoPtr *devs;
|
---|
127 |
|
---|
128 | char *keycodes; /**< XKB keycodes from command line */
|
---|
129 | char *symbols; /**< XKB symbols from command line */
|
---|
130 | char *geometry; /**< XKB geometry from command line */
|
---|
131 | };
|
---|
132 |
|
---|
133 | extern int dmxNumInputs; /**< Number of #dmxInputs */
|
---|
134 | extern DMXInputInfo *dmxInputs; /**< List of inputs */
|
---|
135 |
|
---|
136 | extern void dmxInputInit(DMXInputInfo *dmxInput);
|
---|
137 | extern void dmxInputReInit(DMXInputInfo *dmxInput);
|
---|
138 | extern void dmxInputLateReInit(DMXInputInfo *dmxInput);
|
---|
139 | extern void dmxInputFree(DMXInputInfo *dmxInput);
|
---|
140 | extern void dmxInputLogDevices(void);
|
---|
141 | extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
|
---|
142 |
|
---|
143 | /* These functions are defined in input/dmxeq.c */
|
---|
144 | extern Bool dmxeqInitialized(void);
|
---|
145 | extern void dmxeqEnqueue(xEvent *e);
|
---|
146 | extern void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
|
---|
147 |
|
---|
148 | /* This type is used in input/dmxevents.c. Also, these functions are
|
---|
149 | * defined in input/dmxevents.c */
|
---|
150 | typedef enum {
|
---|
151 | DMX_NO_BLOCK = 0,
|
---|
152 | DMX_BLOCK = 1
|
---|
153 | } DMXBlockType;
|
---|
154 |
|
---|
155 | extern void dmxGetGlobalPosition(int *x, int *y);
|
---|
156 | extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
|
---|
157 | extern void dmxCoreMotion(int x, int y, int delta,
|
---|
158 | DMXBlockType block);
|
---|
159 |
|
---|
160 | /* Support for dynamic addition of inputs. This functions is defined in
|
---|
161 | * config/dmxconfig.c */
|
---|
162 | extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
|
---|
163 | #endif /* DMXINPUT_H */
|
---|