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