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