diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-08-27 20:00:23 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-08-27 20:00:23 +0000 |
commit | 64f3723da22d3bfc96e739092d5111ff44bb85cc (patch) | |
tree | 822a4afdc8ec8f793f5b8a19164231c7d7dfa234 /driver/xf86-input-keyboard/src/kbd.c | |
parent | 57c969c5c3e1df4487c140b401c5a590918f78a7 (diff) |
xf86-input-keyboard 1.3.1
Diffstat (limited to 'driver/xf86-input-keyboard/src/kbd.c')
-rw-r--r-- | driver/xf86-input-keyboard/src/kbd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/driver/xf86-input-keyboard/src/kbd.c b/driver/xf86-input-keyboard/src/kbd.c index 85d8b494f..094628ece 100644 --- a/driver/xf86-input-keyboard/src/kbd.c +++ b/driver/xf86-input-keyboard/src/kbd.c @@ -59,6 +59,8 @@ extern int XkbDfltRepeatInterval; #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 (1 << 31) static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags); static int KbdProc(DeviceIntPtr device, int what); @@ -477,10 +479,9 @@ InitKBD(InputInfoPtr pInfo, Bool init) pKbd->scanPrefix = 0; if (init) { - pKbd->keyLeds = 0; - + pKbd->keyLeds = pKbd->GetLeds(pInfo); UpdateLeds(pInfo); - + pKbd->keyLeds |= INITFLAG; if( pKbd->delay <= 375) rad = 0x00; else if (pKbd->delay <= 625) rad = 0x20; else if (pKbd->delay <= 875) rad = 0x40; @@ -489,8 +490,22 @@ InitKBD(InputInfoPtr pInfo, Bool init) else if (pKbd->rate >= 30) rad |= 0x00; else rad |= ((58 / pKbd->rate) - 2); pKbd->SetKbdRepeat(pInfo, rad); - } else + } else { + int 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 @@ -550,7 +565,6 @@ KbdProc(DeviceIntPtr device, int what) * passing on parts of the VT switch sequence. */ if (pInfo->fd >= 0) { - sleep(1); xf86FlushInput(pInfo->fd); AddEnabledDevice(pInfo->fd); } |