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