dmxcommon.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.
00003  *
00004  * All Rights Reserved.
00005  *
00006  * Permission is hereby granted, free of charge, to any person obtaining
00007  * a copy of this software and associated documentation files (the
00008  * "Software"), to deal in the Software without restriction, including
00009  * without limitation on the rights to use, copy, modify, merge,
00010  * publish, distribute, sublicense, and/or sell copies of the Software,
00011  * and to permit persons to whom the Software is furnished to do so,
00012  * subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice (including the
00015  * next paragraph) shall be included in all copies or substantial
00016  * portions of the Software.
00017  *
00018  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00019  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00021  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
00022  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00023  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00024  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00025  * SOFTWARE.
00026  */
00027 
00028 /*
00029  * Authors:
00030  *   Rickard E. (Rik) Faith <faith@redhat.com>
00031  *
00032  */
00033 
00038 #ifndef _DMXCOMMON_H_
00039 #define _DMXCOMMON_H_
00040 
00041 #define DMX_COMMON_OTHER                    \
00042     Display                 *display;       \
00043     Window                  window;         \
00044     DMXScreenInfo           *be;            \
00045     DMXLocalInputInfoPtr    dmxLocal;       \
00046     int                     initPointerX;   \
00047     int                     initPointerY;   \
00048     long                    eventMask;      \
00049     KeybdCtrl               kctrl;          \
00050     PtrCtrl                 mctrl;          \
00051     int                     kctrlset;       \
00052     int                     mctrlset;       \
00053     KeybdCtrl               savedKctrl;     \
00054     XModifierKeymap         *savedModMap;   \
00055     int                     stateSaved
00056 
00057 #define DMX_COMMON_XKB                      \
00058     DMX_COMMON_OTHER;                       \
00059     XkbDescPtr              xkb;            \
00060     XkbIndicatorRec         savedIndicators
00061 
00062 #define DMX_COMMON_PRIVATE                  \
00063     DMX_COMMON_XKB;                         \
00064     XDevice                 *xi
00065 
00066 #define GETONLYPRIVFROMPRIVATE                                          \
00067     myPrivate            *priv     = private
00068 
00069 #define GETPRIVFROMPRIVATE                                              \
00070     GETONLYPRIVFROMPRIVATE;                                             \
00071     DMXInputInfo         *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
00072 
00073 #define GETDMXLOCALFROMPDEVICE                                          \
00074     DevicePtr            pDev      = &pDevice->public;                  \
00075     DMXLocalInputInfoPtr dmxLocal  = pDev->devicePrivate
00076 
00077 #define GETDMXINPUTFROMPRIV                                             \
00078     DMXInputInfo         *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
00079 
00080 #define GETDMXINPUTFROMPDEVICE                                          \
00081     GETDMXLOCALFROMPDEVICE;                                             \
00082     DMXInputInfo         *dmxInput = &dmxInputs[dmxLocal->inputIdx]
00083 
00084 #define GETDMXLOCALFROMPDEV                                             \
00085     DMXLocalInputInfoPtr dmxLocal  = pDev->devicePrivate
00086 
00087 #define GETDMXINPUTFROMPDEV                                             \
00088     GETDMXLOCALFROMPDEV;                                                \
00089     DMXInputInfo         *dmxInput = &dmxInputs[dmxLocal->inputIdx]
00090 
00091 #define GETPRIVFROMPDEV                                                 \
00092     GETDMXLOCALFROMPDEV;                                                \
00093     myPrivate            *priv     = dmxLocal->private
00094 
00095 #define DMX_KEYBOARD_EVENT_MASK                                         \
00096     (KeyPressMask | KeyReleaseMask | KeymapStateMask)
00097 
00098 #define DMX_POINTER_EVENT_MASK                                          \
00099     (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
00100 
00101 extern void    dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
00102 extern void    dmxCommonKbdGetMap(DevicePtr pDev,
00103                                   KeySymsPtr pKeySyms, CARD8 *pModMap);
00104 extern void    dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
00105 extern void    dmxCommonKbdBell(DevicePtr pDev, int percent,
00106                                 int volume, int pitch, int duration);
00107 extern int     dmxCommonKbdOn(DevicePtr pDev);
00108 extern void    dmxCommonKbdOff(DevicePtr pDev);
00109 extern void    dmxCommonMouGetMap(DevicePtr pDev,
00110                                   unsigned char *map, int *nButtons);
00111 extern void    dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl);
00112 extern int     dmxCommonMouOn(DevicePtr pDev);
00113 extern void    dmxCommonMouOff(DevicePtr pDev);
00114 extern int     dmxFindPointerScreen(int x, int y);
00115 
00116 extern int     dmxCommonOthOn(DevicePtr pDev);
00117 extern void    dmxCommonOthOff(DevicePtr pDev);
00118 extern void    dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
00119 
00120                                 /* helper functions */
00121 extern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
00122 extern void    dmxCommonSaveState(pointer private);
00123 extern void    dmxCommonRestoreState(pointer private);
00124 #endif