[PATCH keyboard 2/5] Removed function InitKBD
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Feb 17 16:20:10 PST 2011
Why have you decided to remove the functionality of initializing the
state of things like NumLock based on the initial LED state? It was
a bit of the hack to propogate things like "NumLock on by default" from
the BIOS up through to the X server, but it worked. (At least it used
to, I haven't checked in a while.)
-alan-
On 02/17/11 04:10 PM, Alexandr Shadchin wrote:
> 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:
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list