[PATCH keyboard 2/5] Removed function InitKBD

Alexandr Shadchin alexandr.shadchin at gmail.com
Thu Feb 17 16:10:12 PST 2011


Before calling InitKBD called KbdCtrl, which sets the LEDS in
accordance with the ctrl->leds. Therefore, further manipulation
InitKBD do not matter.

Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>
---
 src/kbd.c |   53 +----------------------------------------------------
 1 files changed, 1 insertions(+), 52 deletions(-)

diff --git a/src/kbd.c b/src/kbd.c
index 86b5be5..bb1a177 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -46,8 +46,6 @@
 #define SCROLLFLAG	4
 #define MODEFLAG	8
 #define COMPOSEFLAG	16
-/* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
-#define INITFLAG	(1U << 31)
 
 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
@@ -59,9 +57,6 @@ static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused);
 static void PostKbdEvent(InputInfoPtr pInfo, unsigned int key, Bool down);
 
-static void InitKBD(InputInfoPtr pInfo, Bool init);
-static void UpdateLeds(InputInfoPtr pInfo);
-
 _X_EXPORT InputDriverRec KBD = {
 	1,
 	"kbd",
@@ -209,22 +204,6 @@ KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused)
 }
 
 static void
-UpdateLeds(InputInfoPtr pInfo)
-{
-    KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-    unsigned long leds = 0;
-
-    if (pKbd->keyLeds & CAPSFLAG)    leds |= XLED1;
-    if (pKbd->keyLeds & NUMFLAG)     leds |= XLED2;
-    if (pKbd->keyLeds & SCROLLFLAG ||
-        pKbd->keyLeds & MODEFLAG)    leds |= XLED3;
-    if (pKbd->keyLeds & COMPOSEFLAG) leds |= XLED4;
-
-    pKbd->leds = leds;
-    pKbd->SetLeds(pInfo, pKbd->leds);
-}
-
-static void
 KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl)
 {
    unsigned long leds;
@@ -256,35 +235,6 @@ KbdCtrl( DeviceIntPtr device, KeybdCtrl *ctrl)
   pKbd->SetLeds(pInfo, pKbd->leds);
 }
 
-static void
-InitKBD(InputInfoPtr pInfo, Bool init)
-{
-  KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
-
-  pKbd->scanPrefix      = 0;
-
-  if (init) {
-      pKbd->keyLeds = pKbd->GetLeds(pInfo);
-      UpdateLeds(pInfo);
-      pKbd->keyLeds |= INITFLAG;
-  } else {
-      unsigned long leds = pKbd->keyLeds;
-
-      pKbd->keyLeds = pKbd->GetLeds(pInfo);
-      UpdateLeds(pInfo);
-      if ((pKbd->keyLeds & CAPSFLAG) !=
-	  ((leds & INITFLAG) ? 0 : (leds & CAPSFLAG))) {
-	  pKbd->PostEvent(pInfo, KEY_CapsLock, TRUE);
-	  pKbd->PostEvent(pInfo, KEY_CapsLock, FALSE);
-      }
-      if ((pKbd->keyLeds & NUMFLAG) !=
-	  (leds & INITFLAG ? 0 : leds & NUMFLAG)) {
-	  pKbd->PostEvent(pInfo, KEY_NumLock, TRUE);
-	  pKbd->PostEvent(pInfo, KEY_NumLock, FALSE);
-      }
-  }
-}
-
 static int
 KbdProc(DeviceIntPtr device, int what)
 {
@@ -333,7 +283,6 @@ KbdProc(DeviceIntPtr device, int what)
                                          (KbdCtrlProcPtr)KbdCtrl);
          }
 #endif /* XINPUT ABI 5*/
-         InitKBD(pInfo, TRUE);
          break;
   case DEVICE_ON:
     if (device->public.on)
@@ -354,7 +303,7 @@ KbdProc(DeviceIntPtr device, int what)
     }
 
     device->public.on = TRUE;
-    InitKBD(pInfo, FALSE);
+    pKbd->scanPrefix = 0;
     break;
 
   case DEVICE_CLOSE:
-- 
1.7.3.5



More information about the xorg-devel mailing list