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