105b261ecSmrg/************************************************************
205b261ecSmrgCopyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
305b261ecSmrg
405b261ecSmrgPermission to use, copy, modify, and distribute this
505b261ecSmrgsoftware and its documentation for any purpose and without
605b261ecSmrgfee is hereby granted, provided that the above copyright
705b261ecSmrgnotice appear in all copies and that both that copyright
805b261ecSmrgnotice and this permission notice appear in supporting
935c4bbdfSmrgdocumentation, and that the name of Silicon Graphics not be
1035c4bbdfSmrgused in advertising or publicity pertaining to distribution
1105b261ecSmrgof the software without specific prior written permission.
1235c4bbdfSmrgSilicon Graphics makes no representation about the suitability
1305b261ecSmrgof this software for any purpose. It is provided "as is"
1405b261ecSmrgwithout any express or implied warranty.
1505b261ecSmrg
1635c4bbdfSmrgSILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
1735c4bbdfSmrgSOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1805b261ecSmrgAND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
1935c4bbdfSmrgGRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
2035c4bbdfSmrgDAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2135c4bbdfSmrgDATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
2205b261ecSmrgOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
2305b261ecSmrgTHE USE OR PERFORMANCE OF THIS SOFTWARE.
2405b261ecSmrg
2505b261ecSmrg********************************************************/
2605b261ecSmrg
2705b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
2805b261ecSmrg#include <dix-config.h>
2905b261ecSmrg#endif
3005b261ecSmrg
3105b261ecSmrg#include <stdio.h>
3205b261ecSmrg#include <X11/X.h>
3305b261ecSmrg#include <X11/Xproto.h>
3405b261ecSmrg#include <X11/keysym.h>
3505b261ecSmrg#include "inputstr.h"
3605b261ecSmrg#include "scrnintstr.h"
3705b261ecSmrg#include "windowstr.h"
3805b261ecSmrg#include <xkbsrv.h>
3905b261ecSmrg#include <X11/extensions/XI.h>
4005b261ecSmrg
4105b261ecSmrgvoid
4235c4bbdfSmrgXkbDDXKeybdCtrlProc(DeviceIntPtr dev, KeybdCtrl * ctrl)
4305b261ecSmrg{
4435c4bbdfSmrg    int realRepeat;
4505b261ecSmrg
4635c4bbdfSmrg    realRepeat = ctrl->autoRepeat;
4735c4bbdfSmrg    if ((dev->kbdfeed) && (XkbDDXUsesSoftRepeat(dev)))
4835c4bbdfSmrg        ctrl->autoRepeat = 0;
4905b261ecSmrg    if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
5035c4bbdfSmrg        (*dev->key->xkbInfo->kbdProc) (dev, ctrl);
5135c4bbdfSmrg    ctrl->autoRepeat = realRepeat;
5205b261ecSmrg    return;
5305b261ecSmrg}
5405b261ecSmrg
5505b261ecSmrgint
5605b261ecSmrgXkbDDXUsesSoftRepeat(DeviceIntPtr pXDev)
5705b261ecSmrg{
5805b261ecSmrg    return 1;
5905b261ecSmrg}
6005b261ecSmrg
6105b261ecSmrgvoid
6235c4bbdfSmrgXkbDDXChangeControls(DeviceIntPtr dev, XkbControlsPtr old, XkbControlsPtr new)
6305b261ecSmrg{
6435c4bbdfSmrg    unsigned changed, i;
6535c4bbdfSmrg    unsigned char *rep_old, *rep_new, *rep_fb;
6605b261ecSmrg
6735c4bbdfSmrg    changed = new->enabled_ctrls ^ old->enabled_ctrls;
6805b261ecSmrg    for (rep_old = old->per_key_repeat,
6905b261ecSmrg         rep_new = new->per_key_repeat,
7035c4bbdfSmrg         rep_fb = dev->kbdfeed->ctrl.autoRepeats,
7105b261ecSmrg         i = 0; i < XkbPerKeyBitArraySize; i++) {
7205b261ecSmrg        if (rep_old[i] != rep_new[i]) {
7305b261ecSmrg            rep_fb[i] = rep_new[i];
7405b261ecSmrg            changed &= XkbPerKeyRepeatMask;
7505b261ecSmrg        }
7605b261ecSmrg    }
7705b261ecSmrg
7835c4bbdfSmrg    if (changed & XkbPerKeyRepeatMask) {
7935c4bbdfSmrg        if (dev->kbdfeed->CtrlProc)
8035c4bbdfSmrg            (*dev->kbdfeed->CtrlProc) (dev, &dev->kbdfeed->ctrl);
8105b261ecSmrg    }
8205b261ecSmrg    return;
8305b261ecSmrg}
84