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