b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86$ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/*
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright 2001,2002 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 * David H. Dawes <dawes@xfree86.org>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Kevin E. Martin <kem@redhat.com>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Rickard E. (Rik) Faith <faith@redhat.com>
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** \file
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * This file provides access to:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * - global variables available to all hw/dmx routines, and
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * - enumerations and typedefs needed by input routines in hw/dmx (and
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * hw/dmx/input).
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync *
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The goal is that no files in hw/dmx should include header files from
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * hw/dmx/input -- the interface defined here should be the only
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef DMXINPUT_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define DMXINPUT_H
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** Maximum number of file descriptors for SIGIO handling */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define DMX_MAX_SIGIO_FDS 4
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct _DMXInputInfo;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** Reason why window layout was updated. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_REALIZE, /**< Window realized */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_UNREALIZE, /**< Window unrealized */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_RESTACK, /**< Stacking order changed */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_COPY, /**< Window copied */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_RESIZE, /**< Window resized */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_UPDATE_REPARENT /**< Window reparented */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} DMXUpdateType;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef void (*ProcessInputEventsProc)(struct _DMXInputInfo *);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef void (*UpdateWindowInfoProc)(struct _DMXInputInfo *,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMXUpdateType, WindowPtr);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** An opaque structure that is only exposed in the dmx/input layer. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** State of the SIGIO engine */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_USESIGIO, /**< Device can use SIGIO, but is not
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * (e.g., because the VT is switch
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * away). */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} dmxSigioState;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/** DMXInputInfo is typedef'd in #dmx.h so that all routines can have
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * access to the global pointers. However, the elements are only
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * available to input-related routines. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncstruct _DMXInputInfo {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync const char *name; /**< Name of input display or device
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * (from command line or config
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * file) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool freename; /**< If true, free name on destroy */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool detached; /**< If true, input screen is detached */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int inputIdx; /**< Index into #dmxInputs global */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int scrnIdx; /**< Index into #dmxScreens global */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool core; /**< If True, initialize these
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * devices as devices that send core
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * events */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool console; /**< True if console and backend
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * input share the same backend
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * display */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool windows; /**< True if window outlines are
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * draw in console */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ProcessInputEventsProc processInputEvents;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync UpdateWindowInfoProc updateWindowInfo;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /* Local input information */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync dmxSigioState sigioState; /**< Current stat */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int sigioFdCount; /**< Number of fds in use */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /** True if a VT switch is pending, but has not yet happened. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int vt_switch_pending;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /** True if a VT switch has happened. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int vt_switched;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /** Number of devices handled in this _DMXInputInfo structure. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int numDevs;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync /** List of actual input devices. Each _DMXInputInfo structure can
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * refer to more than one device. For example, the keyboard and the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * pointer of a backend display; or all of the XInput extension
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * devices on a backend display. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMXLocalInputInfoPtr *devs;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync char *keycodes; /**< XKB keycodes from command line */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync char *symbols; /**< XKB symbols from command line */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync char *geometry; /**< XKB geometry from command line */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync};
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern int dmxNumInputs; /**< Number of #dmxInputs */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern DMXInputInfo *dmxInputs; /**< List of inputs */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxInputInit(DMXInputInfo *dmxInput);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxInputReInit(DMXInputInfo *dmxInput);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxInputLateReInit(DMXInputInfo *dmxInput);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxInputFree(DMXInputInfo *dmxInput);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxInputLogDevices(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* These functions are defined in input/dmxeq.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern Bool dmxeqInitialized(void);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxeqEnqueue(xEvent *e);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxeqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* This type is used in input/dmxevents.c. Also, these functions are
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * defined in input/dmxevents.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef enum {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_NO_BLOCK = 0,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMX_BLOCK = 1
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} DMXBlockType;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxGetGlobalPosition(int *x, int *y);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern void dmxCoreMotion(int x, int y, int delta,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync DMXBlockType block);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Support for dynamic addition of inputs. This functions is defined in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * config/dmxconfig.c */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncextern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#endif /* DMXINPUT_H */