45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright 2002,2003 Red Hat Inc., Durham, North Carolina.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * All Rights Reserved.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Permission is hereby granted, free of charge, to any person obtaining
45e9809aff7304721fddb95654901b32195c9c7avboxsync * a copy of this software and associated documentation files (the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * "Software"), to deal in the Software without restriction, including
45e9809aff7304721fddb95654901b32195c9c7avboxsync * without limitation on the rights to use, copy, modify, merge,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * publish, distribute, sublicense, and/or sell copies of the Software,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * and to permit persons to whom the Software is furnished to do so,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * subject to the following conditions:
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * The above copyright notice and this permission notice (including the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * next paragraph) shall be included in all copies or substantial
45e9809aff7304721fddb95654901b32195c9c7avboxsync * portions of the Software.
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
45e9809aff7304721fddb95654901b32195c9c7avboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45e9809aff7304721fddb95654901b32195c9c7avboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
45e9809aff7304721fddb95654901b32195c9c7avboxsync * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
45e9809aff7304721fddb95654901b32195c9c7avboxsync * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
45e9809aff7304721fddb95654901b32195c9c7avboxsync * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45e9809aff7304721fddb95654901b32195c9c7avboxsync * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45e9809aff7304721fddb95654901b32195c9c7avboxsync * SOFTWARE.
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Authors:
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Rickard E. (Rik) Faith <faith@redhat.com>
45e9809aff7304721fddb95654901b32195c9c7avboxsync *
45e9809aff7304721fddb95654901b32195c9c7avboxsync */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync/** \file
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Interface to functions used by backend and console input devices.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#ifndef _DMXCOMMON_H_
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define _DMXCOMMON_H_
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_COMMON_OTHER \
45e9809aff7304721fddb95654901b32195c9c7avboxsync Display *display; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync Window window; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXScreenInfo *be; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXLocalInputInfoPtr dmxLocal; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync int initPointerX; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync int initPointerY; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync long eventMask; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync KeybdCtrl kctrl; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync PtrCtrl mctrl; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync int kctrlset; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync int mctrlset; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync KeybdCtrl savedKctrl; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync XModifierKeymap *savedModMap; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync int stateSaved
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_COMMON_XKB \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_COMMON_OTHER; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync XkbDescPtr xkb; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync XkbIndicatorRec savedIndicators
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_COMMON_PRIVATE \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMX_COMMON_XKB; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync XDevice *xi
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETONLYPRIVFROMPRIVATE \
45e9809aff7304721fddb95654901b32195c9c7avboxsync myPrivate *priv = private
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETPRIVFROMPRIVATE \
45e9809aff7304721fddb95654901b32195c9c7avboxsync GETONLYPRIVFROMPRIVATE; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETDMXLOCALFROMPDEVICE \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DevicePtr pDev = &pDevice->public; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETDMXINPUTFROMPRIV \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx]
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETDMXINPUTFROMPDEVICE \
45e9809aff7304721fddb95654901b32195c9c7avboxsync GETDMXLOCALFROMPDEVICE; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETDMXLOCALFROMPDEV \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETDMXINPUTFROMPDEV \
45e9809aff7304721fddb95654901b32195c9c7avboxsync GETDMXLOCALFROMPDEV; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define GETPRIVFROMPDEV \
45e9809aff7304721fddb95654901b32195c9c7avboxsync GETDMXLOCALFROMPDEV; \
45e9809aff7304721fddb95654901b32195c9c7avboxsync myPrivate *priv = dmxLocal->private
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_KEYBOARD_EVENT_MASK \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (KeyPressMask | KeyReleaseMask | KeymapStateMask)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync#define DMX_POINTER_EVENT_MASK \
45e9809aff7304721fddb95654901b32195c9c7avboxsync (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonKbdGetMap(DevicePtr pDev,
45e9809aff7304721fddb95654901b32195c9c7avboxsync KeySymsPtr pKeySyms, CARD8 *pModMap);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl *ctrl);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonKbdBell(DevicePtr pDev, int percent,
45e9809aff7304721fddb95654901b32195c9c7avboxsync int volume, int pitch, int duration);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int dmxCommonKbdOn(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonKbdOff(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonMouGetMap(DevicePtr pDev,
45e9809aff7304721fddb95654901b32195c9c7avboxsync unsigned char *map, int *nButtons);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl *ctrl);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int dmxCommonMouOn(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonMouOff(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int dmxFindPointerScreen(int x, int y);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern int dmxCommonOthOn(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonOthOff(DevicePtr pDev);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info);
45e9809aff7304721fddb95654901b32195c9c7avboxsync
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* helper functions */
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern pointer dmxCommonCopyPrivate(DeviceIntPtr pDevice);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonSaveState(pointer private);
45e9809aff7304721fddb95654901b32195c9c7avboxsyncextern void dmxCommonRestoreState(pointer private);
45e9809aff7304721fddb95654901b32195c9c7avboxsync#endif