Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / dmx / dmxinput.h
CommitLineData
a09e091a
JB
1/*
2 * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
3 *
4 * All Rights Reserved.
5 *
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:
13 *
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.
17 *
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
25 * SOFTWARE.
26 */
27
28/*
29 * Authors:
30 * David H. Dawes <dawes@xfree86.org>
31 * Kevin E. Martin <kem@redhat.com>
32 * Rickard E. (Rik) Faith <faith@redhat.com>
33 *
34 */
35
36/** \file
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
40 * hw/dmx/input).
41 *
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.
45 */
46
47#ifndef DMXINPUT_H
48#define DMXINPUT_H
49
50/** Maximum number of file descriptors for SIGIO handling */
51#define DMX_MAX_SIGIO_FDS 4
52
53struct _DMXInputInfo;
54
55/** Reason why window layout was updated. */
56typedef enum {
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 */
63} DMXUpdateType;
64
65typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *);
66typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *,
67 DMXUpdateType, WindowPtr);
68
69/** An opaque structure that is only exposed in the dmx/input layer. */
70typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
71
72/** State of the SIGIO engine */
73typedef enum {
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
77 * away). */
78 DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
79} dmxSigioState;
80
81/** DMXInputInfo is typedef'd in \a 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. */
84struct _DMXInputInfo {
85 const char *name; /**< Name of input display or device
86 * (from command line or config
87 * file) */
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
94 * events */
95 Bool console; /**< True if console and backend
96 * input share the same backend
97 * display */
98
99 Bool windows; /**< True if window outlines are
100 * draw in console */
101
102 ProcessInputEventsProc processInputEvents;
103 UpdateWindowInfoProc updateWindowInfo;
104
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 */
110
111 /** True if a VT switch is pending, but has not yet happened. */
112 int vt_switch_pending;
113
114 /** True if a VT switch has happened. */
115 int vt_switched;
116
117 /** Number of devices handled in this _DMXInputInfo structure. */
118 int numDevs;
119
120 /** List of actual input devices. Each _DMXInputInfo structure can
121 * refer to more than one device. For example, the keyboard and the
122 * pointer of a backend display; or all of the XInput extension
123 * devices on a backend display. */
124 DMXLocalInputInfoPtr *devs;
125
126 char *keycodes; /**< XKB keycodes from command line */
127 char *symbols; /**< XKB symbols from command line */
128 char *geometry; /**< XKB geometry from command line */
129};
130
131extern int dmxNumInputs; /**< Number of #dmxInputs */
132extern DMXInputInfo *dmxInputs; /**< List of inputs */
133
134extern void dmxInputInit(DMXInputInfo * dmxInput);
135extern void dmxInputReInit(DMXInputInfo * dmxInput);
136extern void dmxInputLateReInit(DMXInputInfo * dmxInput);
137extern void dmxInputFree(DMXInputInfo * dmxInput);
138extern void dmxInputLogDevices(void);
139extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
140
141/* These functions are defined in input/dmxeq.c */
142extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen,
143 Bool fromDIX);
144
145/* This type is used in input/dmxevents.c. Also, these functions are
146 * defined in input/dmxevents.c */
147typedef enum {
148 DMX_NO_BLOCK = 0,
149 DMX_BLOCK = 1
150} DMXBlockType;
151
152extern void dmxGetGlobalPosition(int *x, int *y);
153extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
154extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
155 DMXBlockType block);
156
157/* Support for dynamic addition of inputs. This functions is defined in
158 * config/dmxconfig.c */
159extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
160#endif /* DMXINPUT_H */