xref: /OK3568_Linux_fs/external/xserver/xkb/ddxLEDs.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /************************************************************
2*4882a593Smuzhiyun Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
3*4882a593Smuzhiyun 
4*4882a593Smuzhiyun Permission to use, copy, modify, and distribute this
5*4882a593Smuzhiyun software and its documentation for any purpose and without
6*4882a593Smuzhiyun fee is hereby granted, provided that the above copyright
7*4882a593Smuzhiyun notice appear in all copies and that both that copyright
8*4882a593Smuzhiyun notice and this permission notice appear in supporting
9*4882a593Smuzhiyun documentation, and that the name of Silicon Graphics not be
10*4882a593Smuzhiyun used in advertising or publicity pertaining to distribution
11*4882a593Smuzhiyun of the software without specific prior written permission.
12*4882a593Smuzhiyun Silicon Graphics makes no representation about the suitability
13*4882a593Smuzhiyun of this software for any purpose. It is provided "as is"
14*4882a593Smuzhiyun without any express or implied warranty.
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17*4882a593Smuzhiyun SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18*4882a593Smuzhiyun AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19*4882a593Smuzhiyun GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20*4882a593Smuzhiyun DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21*4882a593Smuzhiyun DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22*4882a593Smuzhiyun OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
23*4882a593Smuzhiyun THE USE OR PERFORMANCE OF THIS SOFTWARE.
24*4882a593Smuzhiyun 
25*4882a593Smuzhiyun ********************************************************/
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun #ifdef HAVE_DIX_CONFIG_H
28*4882a593Smuzhiyun #include <dix-config.h>
29*4882a593Smuzhiyun #endif
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #include <stdio.h>
32*4882a593Smuzhiyun #include <X11/X.h>
33*4882a593Smuzhiyun #include <X11/Xproto.h>
34*4882a593Smuzhiyun #include <X11/keysym.h>
35*4882a593Smuzhiyun #include "inputstr.h"
36*4882a593Smuzhiyun #include "scrnintstr.h"
37*4882a593Smuzhiyun #include "windowstr.h"
38*4882a593Smuzhiyun #include <xkbsrv.h>
39*4882a593Smuzhiyun #include <X11/extensions/XI.h>
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun static void
XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new)42*4882a593Smuzhiyun XkbDDXUpdateIndicators(DeviceIntPtr dev, CARD32 new)
43*4882a593Smuzhiyun {
44*4882a593Smuzhiyun     dev->kbdfeed->ctrl.leds = new;
45*4882a593Smuzhiyun     (*dev->kbdfeed->CtrlProc) (dev, &dev->kbdfeed->ctrl);
46*4882a593Smuzhiyun     return;
47*4882a593Smuzhiyun }
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun void
XkbDDXUpdateDeviceIndicators(DeviceIntPtr dev,XkbSrvLedInfoPtr sli,CARD32 new)50*4882a593Smuzhiyun XkbDDXUpdateDeviceIndicators(DeviceIntPtr dev, XkbSrvLedInfoPtr sli, CARD32 new)
51*4882a593Smuzhiyun {
52*4882a593Smuzhiyun     if (sli->fb.kf == dev->kbdfeed)
53*4882a593Smuzhiyun         XkbDDXUpdateIndicators(dev, new);
54*4882a593Smuzhiyun     else if (sli->class == KbdFeedbackClass) {
55*4882a593Smuzhiyun         KbdFeedbackPtr kf;
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun         kf = sli->fb.kf;
58*4882a593Smuzhiyun         if (kf && kf->CtrlProc) {
59*4882a593Smuzhiyun             (*kf->CtrlProc) (dev, &kf->ctrl);
60*4882a593Smuzhiyun         }
61*4882a593Smuzhiyun     }
62*4882a593Smuzhiyun     else if (sli->class == LedFeedbackClass) {
63*4882a593Smuzhiyun         LedFeedbackPtr lf;
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun         lf = sli->fb.lf;
66*4882a593Smuzhiyun         if (lf && lf->CtrlProc) {
67*4882a593Smuzhiyun             (*lf->CtrlProc) (dev, &lf->ctrl);
68*4882a593Smuzhiyun         }
69*4882a593Smuzhiyun     }
70*4882a593Smuzhiyun     return;
71*4882a593Smuzhiyun }
72