dmxinput.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. * Authors:
  29. * David H. Dawes <dawes@xfree86.org>
  30. * Kevin E. Martin <kem@redhat.com>
  31. * Rickard E. (Rik) Faith <faith@redhat.com>
  32. *
  33. */
  34. /** \file
  35. * This file provides access to:
  36. * - global variables available to all hw/dmx routines, and
  37. * - enumerations and typedefs needed by input routines in hw/dmx (and
  38. * hw/dmx/input).
  39. *
  40. * The goal is that no files in hw/dmx should include header files from
  41. * hw/dmx/input -- the interface defined here should be the only
  42. * interface exported to the hw/dmx layer. \see input/dmxinputinit.c.
  43. */
  44. #ifndef DMXINPUT_H
  45. #define DMXINPUT_H
  46. /** Maximum number of file descriptors for SIGIO handling */
  47. #define DMX_MAX_SIGIO_FDS 4
  48. struct _DMXInputInfo;
  49. /** Reason why window layout was updated. */
  50. typedef enum {
  51. DMX_UPDATE_REALIZE, /**< Window realized */
  52. DMX_UPDATE_UNREALIZE, /**< Window unrealized */
  53. DMX_UPDATE_RESTACK, /**< Stacking order changed */
  54. DMX_UPDATE_COPY, /**< Window copied */
  55. DMX_UPDATE_RESIZE, /**< Window resized */
  56. DMX_UPDATE_REPARENT /**< Window reparented */
  57. } DMXUpdateType;
  58. typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *);
  59. typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *,
  60. DMXUpdateType, WindowPtr);
  61. /** An opaque structure that is only exposed in the dmx/input layer. */
  62. typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr;
  63. /** State of the SIGIO engine */
  64. typedef enum {
  65. DMX_NOSIGIO = 0, /**< Device does not use SIGIO at all. */
  66. DMX_USESIGIO, /**< Device can use SIGIO, but is not
  67. * (e.g., because the VT is switch
  68. * away). */
  69. DMX_ACTIVESIGIO /**< Device is currently using SIGIO. */
  70. } dmxSigioState;
  71. /** DMXInputInfo is typedef'd in \a dmx.h so that all routines can have
  72. * access to the global pointers. However, the elements are only
  73. * available to input-related routines. */
  74. struct _DMXInputInfo {
  75. const char *name; /**< Name of input display or device
  76. * (from command line or config
  77. * file) */
  78. Bool freename; /**< If true, free name on destroy */
  79. Bool detached; /**< If true, input screen is detached */
  80. int inputIdx; /**< Index into #dmxInputs global */
  81. int scrnIdx; /**< Index into #dmxScreens global */
  82. Bool core; /**< If True, initialize these
  83. * devices as devices that send core
  84. * events */
  85. Bool console; /**< True if console and backend
  86. * input share the same backend
  87. * display */
  88. Bool windows; /**< True if window outlines are
  89. * draw in console */
  90. ProcessInputEventsProc processInputEvents;
  91. UpdateWindowInfoProc updateWindowInfo;
  92. /* Local input information */
  93. dmxSigioState sigioState; /**< Current stat */
  94. int sigioFdCount; /**< Number of fds in use */
  95. int sigioFd[DMX_MAX_SIGIO_FDS]; /**< List of fds */
  96. Bool sigioAdded[DMX_MAX_SIGIO_FDS]; /**< Active fds */
  97. /** True if a VT switch is pending, but has not yet happened. */
  98. int vt_switch_pending;
  99. /** True if a VT switch has happened. */
  100. int vt_switched;
  101. /** Number of devices handled in this _DMXInputInfo structure. */
  102. int numDevs;
  103. /** List of actual input devices. Each _DMXInputInfo structure can
  104. * refer to more than one device. For example, the keyboard and the
  105. * pointer of a backend display; or all of the XInput extension
  106. * devices on a backend display. */
  107. DMXLocalInputInfoPtr *devs;
  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. extern int dmxNumInputs; /**< Number of #dmxInputs */
  113. extern DMXInputInfo *dmxInputs; /**< List of inputs */
  114. extern void dmxInputInit(DMXInputInfo * dmxInput);
  115. extern void dmxInputReInit(DMXInputInfo * dmxInput);
  116. extern void dmxInputLateReInit(DMXInputInfo * dmxInput);
  117. extern void dmxInputFree(DMXInputInfo * dmxInput);
  118. extern void dmxInputLogDevices(void);
  119. extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow);
  120. /* These functions are defined in input/dmxeq.c */
  121. extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen,
  122. Bool fromDIX);
  123. /* This type is used in input/dmxevents.c. Also, these functions are
  124. * defined in input/dmxevents.c */
  125. typedef enum {
  126. DMX_NO_BLOCK = 0,
  127. DMX_BLOCK = 1
  128. } DMXBlockType;
  129. extern void dmxGetGlobalPosition(int *x, int *y);
  130. extern DMXScreenInfo *dmxFindFirstScreen(int x, int y);
  131. extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta,
  132. DMXBlockType block);
  133. /* Support for dynamic addition of inputs. This functions is defined in
  134. * config/dmxconfig.c */
  135. extern DMXInputInfo *dmxConfigAddInput(const char *name, int core);
  136. #endif /* DMXINPUT_H */