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