f78b12e570284aa8291f4ca1add24937fd107403vboxsync/*
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * All Rights Reserved.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Permission is hereby granted, free of charge, to any person obtaining
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * a copy of this software and associated documentation files (the
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * "Software"), to deal in the Software without restriction, including
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * without limitation on the rights to use, copy, modify, merge,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * publish, distribute, sublicense, and/or sell copies of the Software,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * and to permit persons to whom the Software is furnished to do so,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * subject to the following conditions:
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * The above copyright notice and this permission notice (including the
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * next paragraph) shall be included in all copies or substantial
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * portions of the Software.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * SOFTWARE.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/*
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Authors:
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * David H. Dawes <dawes@xfree86.org>
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Kevin E. Martin <kem@redhat.com>
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * Rickard E. (Rik) Faith <faith@redhat.com>
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** \file
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * This file provides access to:
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * - global variables available to all hw/dmx routines, and
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * - enumerations and typedefs needed by input routines in hw/dmx (and
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * hw/dmx/input).
f78b12e570284aa8291f4ca1add24937fd107403vboxsync *
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * The goal is that no files in hw/dmx should include header files from
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * hw/dmx/input -- the interface defined here should be the only
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
f78b12e570284aa8291f4ca1add24937fd107403vboxsync */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#ifndef DMXINPUT_H
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define DMXINPUT_H
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** Maximum number of file descriptors for SIGIO handling */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#define DMX_MAX_SIGIO_FDS 4
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncstruct _DMXInputInfo;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** Reason why window layout was updated. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef enum {
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_REALIZE, /**< Window realized */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_UNREALIZE, /**< Window unrealized */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_RESTACK, /**< Stacking order changed */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_COPY, /**< Window copied */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_RESIZE, /**< Window resized */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_UPDATE_REPARENT /**< Window reparented */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync} DMXUpdateType;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMXUpdateType, WindowPtr);
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** An opaque structure that is only exposed in the dmx/input layer. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** State of the SIGIO engine */
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef enum {
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_USESIGIO, /**< Device can use SIGIO, but is not
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * (e.g., because the VT is switch
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * away). */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync} dmxSigioState;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/** DMXInputInfo is typedef'd in \a dmx.h so that all routines can have
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * access to the global pointers. However, the elements are only
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * available to input-related routines. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncstruct _DMXInputInfo {
f78b12e570284aa8291f4ca1add24937fd107403vboxsync const char *name; /**< Name of input display or device
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * (from command line or config
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * file) */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool freename; /**< If true, free name on destroy */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool detached; /**< If true, input screen is detached */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int inputIdx; /**< Index into #dmxInputs global */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int scrnIdx; /**< Index into #dmxScreens global */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool core; /**< If True, initialize these
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * devices as devices that send core
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * events */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool console; /**< True if console and backend
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * input share the same backend
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * display */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool windows; /**< True if window outlines are
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * draw in console */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync ProcessInputEventsProc processInputEvents;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync UpdateWindowInfoProc updateWindowInfo;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync /* Local input information */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync dmxSigioState sigioState; /**< Current stat */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int sigioFdCount; /**< Number of fds in use */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync /** True if a VT switch is pending, but has not yet happened. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int vt_switch_pending;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync /** True if a VT switch has happened. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int vt_switched;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync /** Number of devices handled in this _DMXInputInfo structure. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync int numDevs;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync /** List of actual input devices. Each _DMXInputInfo structure can
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * refer to more than one device. For example, the keyboard and the
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * pointer of a backend display; or all of the XInput extension
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * devices on a backend display. */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMXLocalInputInfoPtr *devs;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync char *keycodes; /**< XKB keycodes from command line */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync char *symbols; /**< XKB symbols from command line */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync char *geometry; /**< XKB geometry from command line */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync};
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern int dmxNumInputs; /**< Number of #dmxInputs */
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern DMXInputInfo *dmxInputs; /**< List of inputs */
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxInputInit(DMXInputInfo *dmxInput);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxInputReInit(DMXInputInfo *dmxInput);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxInputLateReInit(DMXInputInfo *dmxInput);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxInputFree(DMXInputInfo *dmxInput);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxInputLogDevices(void);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/* These functions are defined in input/dmxeq.c */
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX);
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/* This type is used in input/dmxevents.c. Also, these functions are
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * defined in input/dmxevents.c */
f78b12e570284aa8291f4ca1add24937fd107403vboxsynctypedef enum {
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_NO_BLOCK = 0,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMX_BLOCK = 1
f78b12e570284aa8291f4ca1add24937fd107403vboxsync} DMXBlockType;
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxGetGlobalPosition(int *x, int *y);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
f78b12e570284aa8291f4ca1add24937fd107403vboxsync DMXBlockType block);
f78b12e570284aa8291f4ca1add24937fd107403vboxsync
f78b12e570284aa8291f4ca1add24937fd107403vboxsync/* Support for dynamic addition of inputs. This functions is defined in
f78b12e570284aa8291f4ca1add24937fd107403vboxsync * config/dmxconfig.c */
f78b12e570284aa8291f4ca1add24937fd107403vboxsyncextern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
f78b12e570284aa8291f4ca1add24937fd107403vboxsync#endif /* DMXINPUT_H */