1 | /* $XFree86$ */
|
---|
2 | /*
|
---|
3 | * Copyright 2002,2003 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 | * Rickard E. (Rik) Faith <[email protected]>
|
---|
32 | *
|
---|
33 | */
|
---|
34 |
|
---|
35 | /** \file
|
---|
36 | * Interface to functions used by backend and console input devices.
|
---|
37 | * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */
|
---|
38 |
|
---|
39 | #ifndef _DMXCOMMON_H_
|
---|
40 | #define _DMXCOMMON_H_
|
---|
41 |
|
---|
42 | #define DMX_COMMON_OTHER \
|
---|
43 | Display *display; \
|
---|
44 | Window window; \
|
---|
45 | DMXScreenInfo *be; \
|
---|
46 | DMXLocalInputInfoPtr dmxLocal; \
|
---|
47 | int initPointerX; \
|
---|
48 | int initPointerY; \
|
---|
49 | long eventMask; \
|
---|
50 | KeybdCtrl kctrl; \
|
---|
51 | PtrCtrl mctrl; \
|
---|
52 | int kctrlset; \
|
---|
53 | int mctrlset; \
|
---|
54 | KeybdCtrl savedKctrl; \
|
---|
55 | XModifierKeymap *savedModMap; \
|
---|
56 | int stateSaved
|
---|
57 |
|
---|
58 | #ifdef XKB
|
---|
59 | #define DMX_COMMON_XKB \
|
---|
60 | DMX_COMMON_OTHER; \
|
---|
61 | XkbDescPtr xkb; \
|
---|
62 | XkbIndicatorRec savedIndicators
|
---|
63 | #else
|
---|
64 | #define DMX_COMMON_XKB DMX_COMMON_OTHER
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #ifdef XINPUT
|
---|
68 | #define DMX_COMMON_PRIVATE \
|
---|
69 | DMX_COMMON_XKB; \
|
---|
70 | XDevice *xi
|
---|
71 | #else
|
---|
72 | #define DMX_COMMON_PRIVATE DMX_COMMON_OTHER
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | #define GETONLYPRIVFROMPRIVATE \
|
---|
76 | myPrivate *priv = private
|
---|
77 |
|
---|
78 | #define GETPRIVFROMPRIVATE \
|
---|
79 | GETONLYPRIVFROMPRIVATE; \
|
---|
80 | DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
|
---|
81 |
|
---|
82 | #define GETDMXLOCALFROMPDEVICE \
|
---|
83 | DevicePtr pDev = &pDevice->public; \
|
---|
84 | DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
|
---|
85 |
|
---|
86 | #define GETDMXINPUTFROMPRIV \
|
---|
87 | DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
|
---|
88 |
|
---|
89 | #define GETDMXINPUTFROMPDEVICE \
|
---|
90 | GETDMXLOCALFROMPDEVICE; \
|
---|
91 | DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
|
---|
92 |
|
---|
93 | #define GETDMXLOCALFROMPDEV \
|
---|
94 | DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
|
---|
95 |
|
---|
96 | #define GETDMXINPUTFROMPDEV \
|
---|
97 | GETDMXLOCALFROMPDEV; \
|
---|
98 | DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
|
---|
99 |
|
---|
100 | #define GETPRIVFROMPDEV \
|
---|
101 | GETDMXLOCALFROMPDEV; \
|
---|
102 | myPrivate *priv = dmxLocal->private
|
---|
103 |
|
---|
104 | #define DMX_KEYBOARD_EVENT_MASK \
|
---|
105 | (KeyPressMask | KeyReleaseMask | KeymapStateMask)
|
---|
106 |
|
---|
107 | #define DMX_POINTER_EVENT_MASK \
|
---|
108 | (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
---|
109 |
|
---|
110 | extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
|
---|
111 | extern void dmxCommonKbdGetMap(DevicePtr pDev,
|
---|
112 | KeySymsPtr pKeySyms, CARD8 *pModMap);
|
---|
113 | extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
|
---|
114 | extern void dmxCommonKbdBell(DevicePtr pDev, int percent,
|
---|
115 | int volume, int pitch, int duration);
|
---|
116 | extern int dmxCommonKbdOn(DevicePtr pDev);
|
---|
117 | extern void dmxCommonKbdOff(DevicePtr pDev);
|
---|
118 | extern void dmxCommonMouGetMap(DevicePtr pDev,
|
---|
119 | unsigned char *map, int *nButtons);
|
---|
120 | extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl);
|
---|
121 | extern int dmxCommonMouOn(DevicePtr pDev);
|
---|
122 | extern void dmxCommonMouOff(DevicePtr pDev);
|
---|
123 | extern int dmxFindPointerScreen(int x, int y);
|
---|
124 |
|
---|
125 | extern int dmxCommonOthOn(DevicePtr pDev);
|
---|
126 | extern void dmxCommonOthOff(DevicePtr pDev);
|
---|
127 | extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
|
---|
128 |
|
---|
129 | /* helper functions */
|
---|
130 | extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
|
---|
131 | extern void dmxCommonSaveState(pointer private);
|
---|
132 | extern void dmxCommonRestoreState(pointer private);
|
---|
133 | #endif
|
---|