1 /* 2 * Copyright 2001,2002 Red Hat Inc., Durham, North Carolina. 3 * 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining 7 * a copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation on the rights to use, copy, modify, merge, 10 * publish, distribute, sublicense, and/or sell copies of the Software, 11 * and to permit persons to whom the Software is furnished to do so, 12 * subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial 16 * portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS 22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 * SOFTWARE. 26 */ 27 28 /* 29 * Authors: 30 * David H. Dawes <dawes@xfree86.org> 31 * Kevin E. Martin <kem@redhat.com> 32 * Rickard E. (Rik) Faith <faith@redhat.com> 33 * 34 */ 35 36 /** \file 37 * This file provides access to: 38 * - global variables available to all hw/dmx routines, and 39 * - enumerations and typedefs needed by input routines in hw/dmx (and 40 * hw/dmx/input). 41 * 42 * The goal is that no files in hw/dmx should include header files from 43 * hw/dmx/input -- the interface defined here should be the only 44 * interface exported to the hw/dmx layer. \see input/dmxinputinit.c. 45 */ 46 47 #ifndef DMXINPUT_H 48 #define DMXINPUT_H 49 50 struct _DMXInputInfo; 51 52 /** Reason why window layout was updated. */ 53 typedef enum { 54 DMX_UPDATE_REALIZE, /**< Window realized */ 55 DMX_UPDATE_UNREALIZE, /**< Window unrealized */ 56 DMX_UPDATE_RESTACK, /**< Stacking order changed */ 57 DMX_UPDATE_COPY, /**< Window copied */ 58 DMX_UPDATE_RESIZE, /**< Window resized */ 59 DMX_UPDATE_REPARENT /**< Window reparented */ 60 } DMXUpdateType; 61 62 typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *); 63 typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *, 64 DMXUpdateType, WindowPtr); 65 66 /** An opaque structure that is only exposed in the dmx/input layer. */ 67 typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr; 68 69 /** DMXInputInfo is typedef'd in \a dmx.h so that all routines can have 70 * access to the global pointers. However, the elements are only 71 * available to input-related routines. */ 72 struct _DMXInputInfo { 73 const char *name; /**< Name of input display or device 74 * (from command line or config 75 * file) */ 76 Bool freename; /**< If true, free name on destroy */ 77 Bool detached; /**< If true, input screen is detached */ 78 int inputIdx; /**< Index into #dmxInputs global */ 79 int scrnIdx; /**< Index into #dmxScreens global */ 80 Bool core; /**< If True, initialize these 81 * devices as devices that send core 82 * events */ 83 Bool console; /**< True if console and backend 84 * input share the same backend 85 * display */ 86 87 Bool windows; /**< True if window outlines are 88 * draw in console */ 89 90 ProcessInputEventsProc processInputEvents; 91 UpdateWindowInfoProc updateWindowInfo; 92 93 /** True if a VT switch is pending, but has not yet happened. */ 94 int vt_switch_pending; 95 96 /** True if a VT switch has happened. */ 97 int vt_switched; 98 99 /** Number of devices handled in this _DMXInputInfo structure. */ 100 int numDevs; 101 102 /** List of actual input devices. Each _DMXInputInfo structure can 103 * refer to more than one device. For example, the keyboard and the 104 * pointer of a backend display; or all of the XInput extension 105 * devices on a backend display. */ 106 DMXLocalInputInfoPtr *devs; 107 108 char *keycodes; /**< XKB keycodes from command line */ 109 char *symbols; /**< XKB symbols from command line */ 110 char *geometry; /**< XKB geometry from command line */ 111 }; 112 113 extern int dmxNumInputs; /**< Number of #dmxInputs */ 114 extern DMXInputInfo *dmxInputs; /**< List of inputs */ 115 116 extern void dmxInputInit(DMXInputInfo * dmxInput); 117 extern void dmxInputReInit(DMXInputInfo * dmxInput); 118 extern void dmxInputLateReInit(DMXInputInfo * dmxInput); 119 extern void dmxInputFree(DMXInputInfo * dmxInput); 120 extern void dmxInputLogDevices(void); 121 extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow); 122 123 /* These functions are defined in input/dmxeq.c */ 124 extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, 125 Bool fromDIX); 126 127 /* This type is used in input/dmxevents.c. Also, these functions are 128 * defined in input/dmxevents.c */ 129 typedef enum { 130 DMX_NO_BLOCK = 0, 131 DMX_BLOCK = 1 132 } DMXBlockType; 133 134 extern void dmxGetGlobalPosition(int *x, int *y); 135 extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); 136 extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, 137 DMXBlockType block); 138 139 /* Support for dynamic addition of inputs. This functions is defined in 140 * config/dmxconfig.c */ 141 extern DMXInputInfo *dmxConfigAddInput(const char *name, int core); 142 #endif /* DMXINPUT_H */ 143