dmxinput.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. * Provide the main entry points for input initialization and processing
  36. * that arequired by the dix layer.
  37. */
  38. #ifdef HAVE_DMX_CONFIG_H
  39. #include <dmx-config.h>
  40. #endif
  41. #include "dmx.h"
  42. #include "dmxlog.h"
  43. #include "dmxinput.h"
  44. #include "inputstr.h"
  45. #include "input.h"
  46. #include "mi.h"
  47. /** Returns TRUE if the key is a valid modifier. For PC-class
  48. * keyboards, all keys can be used as modifiers, so return TRUE
  49. * always. */
  50. Bool
  51. LegalModifier(unsigned int key, DeviceIntPtr pDev)
  52. {
  53. return TRUE;
  54. }
  55. /** Called from dix/main.c on each server generation to initialize
  56. * inputs. All the work is done in dmxInputInit. \see
  57. * dmxInputInit() */
  58. void
  59. InitInput(int argc, char **argv)
  60. {
  61. int i;
  62. DMXInputInfo *dmxInput;
  63. if (!dmxNumInputs)
  64. dmxLog(dmxFatal, "InitInput: no inputs specified\n");
  65. for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
  66. dmxInputInit(dmxInput);
  67. mieqInit();
  68. }
  69. void
  70. CloseInput(void)
  71. {
  72. mieqFini();
  73. }
  74. /** Called from dix/dispatch.c in Dispatch() whenever input events
  75. * require processing. All the work is done in the lower level
  76. * routines. */
  77. void
  78. ProcessInputEvents(void)
  79. {
  80. int i;
  81. DMXInputInfo *dmxInput;
  82. for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
  83. if (!dmxInput->detached && dmxInput->processInputEvents)
  84. dmxInput->processInputEvents(dmxInput);
  85. }
  86. /** This routine is called from \a dmxwindow.c whenever the layout of
  87. * windows on the display might have changed. This information is used
  88. * by input drivers (currently only the console driver) that provide
  89. * information about window layout to the user. */
  90. void
  91. dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow)
  92. {
  93. int i;
  94. DMXInputInfo *dmxInput;
  95. for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++)
  96. if (!dmxInput->detached && dmxInput->updateWindowInfo)
  97. dmxInput->updateWindowInfo(dmxInput, type, pWindow);
  98. }
  99. int
  100. NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
  101. DeviceIntPtr *pdev)
  102. {
  103. return BadRequest;
  104. }
  105. void
  106. DeleteInputDeviceRequest(DeviceIntPtr pDev)
  107. {
  108. }