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 | #define DMX_COMMON_PRIVATE \
|
---|
67 | DMX_COMMON_XKB; \
|
---|
68 | XDevice *xi
|
---|
69 |
|
---|
70 | #define GETONLYPRIVFROMPRIVATE \
|
---|
71 | myPrivate *priv = private
|
---|
72 |
|
---|
73 | #define GETPRIVFROMPRIVATE \
|
---|
74 | GETONLYPRIVFROMPRIVATE; \
|
---|
75 | DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
|
---|
76 |
|
---|
77 | #define GETDMXLOCALFROMPDEVICE \
|
---|
78 | DevicePtr pDev = &pDevice->public; \
|
---|
79 | DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
|
---|
80 |
|
---|
81 | #define GETDMXINPUTFROMPRIV \
|
---|
82 | DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
|
---|
83 |
|
---|
84 | #define GETDMXINPUTFROMPDEVICE \
|
---|
85 | GETDMXLOCALFROMPDEVICE; \
|
---|
86 | DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
|
---|
87 |
|
---|
88 | #define GETDMXLOCALFROMPDEV \
|
---|
89 | DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
|
---|
90 |
|
---|
91 | #define GETDMXINPUTFROMPDEV \
|
---|
92 | GETDMXLOCALFROMPDEV; \
|
---|
93 | DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
|
---|
94 |
|
---|
95 | #define GETPRIVFROMPDEV \
|
---|
96 | GETDMXLOCALFROMPDEV; \
|
---|
97 | myPrivate *priv = dmxLocal->private
|
---|
98 |
|
---|
99 | #define DMX_KEYBOARD_EVENT_MASK \
|
---|
100 | (KeyPressMask | KeyReleaseMask | KeymapStateMask)
|
---|
101 |
|
---|
102 | #define DMX_POINTER_EVENT_MASK \
|
---|
103 | (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
|
---|
104 |
|
---|
105 | extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
|
---|
106 | extern void dmxCommonKbdGetMap(DevicePtr pDev,
|
---|
107 | KeySymsPtr pKeySyms, CARD8 *pModMap);
|
---|
108 | extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
|
---|
109 | extern void dmxCommonKbdBell(DevicePtr pDev, int percent,
|
---|
110 | int volume, int pitch, int duration);
|
---|
111 | extern int dmxCommonKbdOn(DevicePtr pDev);
|
---|
112 | extern void dmxCommonKbdOff(DevicePtr pDev);
|
---|
113 | extern void dmxCommonMouGetMap(DevicePtr pDev,
|
---|
114 | unsigned char *map, int *nButtons);
|
---|
115 | extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl);
|
---|
116 | extern int dmxCommonMouOn(DevicePtr pDev);
|
---|
117 | extern void dmxCommonMouOff(DevicePtr pDev);
|
---|
118 | extern int dmxFindPointerScreen(int x, int y);
|
---|
119 |
|
---|
120 | extern int dmxCommonOthOn(DevicePtr pDev);
|
---|
121 | extern void dmxCommonOthOff(DevicePtr pDev);
|
---|
122 | extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
|
---|
123 |
|
---|
124 | /* helper functions */
|
---|
125 | extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
|
---|
126 | extern void dmxCommonSaveState(pointer private);
|
---|
127 | extern void dmxCommonRestoreState(pointer private);
|
---|
128 | #endif
|
---|