ddxCtrls.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /************************************************************
  2. Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
  3. Permission to use, copy, modify, and distribute this
  4. software and its documentation for any purpose and without
  5. fee is hereby granted, provided that the above copyright
  6. notice appear in all copies and that both that copyright
  7. notice and this permission notice appear in supporting
  8. documentation, and that the name of Silicon Graphics not be
  9. used in advertising or publicity pertaining to distribution
  10. of the software without specific prior written permission.
  11. Silicon Graphics makes no representation about the suitability
  12. of this software for any purpose. It is provided "as is"
  13. without any express or implied warranty.
  14. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  15. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  16. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  17. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
  18. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  19. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  20. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
  21. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. ********************************************************/
  23. #ifdef HAVE_DIX_CONFIG_H
  24. #include <dix-config.h>
  25. #endif
  26. #include <stdio.h>
  27. #include <X11/X.h>
  28. #include <X11/Xproto.h>
  29. #include <X11/keysym.h>
  30. #include "inputstr.h"
  31. #include "scrnintstr.h"
  32. #include "windowstr.h"
  33. #include <xkbsrv.h>
  34. #include <X11/extensions/XI.h>
  35. void
  36. XkbDDXKeybdCtrlProc(DeviceIntPtr dev, KeybdCtrl * ctrl)
  37. {
  38. int realRepeat;
  39. realRepeat = ctrl->autoRepeat;
  40. if ((dev->kbdfeed) && (XkbDDXUsesSoftRepeat(dev)))
  41. ctrl->autoRepeat = 0;
  42. if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
  43. (*dev->key->xkbInfo->kbdProc) (dev, ctrl);
  44. ctrl->autoRepeat = realRepeat;
  45. return;
  46. }
  47. int
  48. XkbDDXUsesSoftRepeat(DeviceIntPtr pXDev)
  49. {
  50. return 1;
  51. }
  52. void
  53. XkbDDXChangeControls(DeviceIntPtr dev, XkbControlsPtr old, XkbControlsPtr new)
  54. {
  55. unsigned changed, i;
  56. unsigned char *rep_old, *rep_new, *rep_fb;
  57. changed = new->enabled_ctrls ^ old->enabled_ctrls;
  58. for (rep_old = old->per_key_repeat,
  59. rep_new = new->per_key_repeat,
  60. rep_fb = dev->kbdfeed->ctrl.autoRepeats,
  61. i = 0; i < XkbPerKeyBitArraySize; i++) {
  62. if (rep_old[i] != rep_new[i]) {
  63. rep_fb[i] = rep_new[i];
  64. changed &= XkbPerKeyRepeatMask;
  65. }
  66. }
  67. if (changed & XkbPerKeyRepeatMask) {
  68. if (dev->kbdfeed->CtrlProc)
  69. (*dev->kbdfeed->CtrlProc) (dev, &dev->kbdfeed->ctrl);
  70. }
  71. return;
  72. }