From 1962ef9204bef87a114d50c4d7755c1ba953b2d5 Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade Date: Tue, 8 Apr 2008 13:49:39 -0300 Subject: [PATCH] Don't send events in DEVICE_INIT, only after DEVICE_ON. See http://bugs.freedesktop.org/show_bug.cgi?id=2243#c15 for a description of the problem fixed in this patch. Now only the driver leds state is synched with virtual console state, and if required, events are post in DEVICE_ON. Note that this relies on kbd.c:InitKBD() being called only twice, i.e. once for DEVICE_INIT and once for DEVICE_ON. --- src/kbd.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/kbd.c b/src/kbd.c index dc9ea7a..8479c81 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -472,15 +472,6 @@ InitKBD(InputInfoPtr pInfo, Bool init) if (init) { pKbd->keyLeds = pKbd->GetLeds(pInfo); UpdateLeds(pInfo); - if (pKbd->keyLeds & CAPSFLAG) { - pKbd->PostEvent(pInfo, KEY_CapsLock, TRUE); - pKbd->PostEvent(pInfo, KEY_CapsLock, FALSE); - } - if (pKbd->keyLeds & NUMFLAG) { - pKbd->PostEvent(pInfo, KEY_NumLock, TRUE); - pKbd->PostEvent(pInfo, KEY_NumLock, FALSE); - } - if( pKbd->delay <= 375) rad = 0x00; else if (pKbd->delay <= 625) rad = 0x20; else if (pKbd->delay <= 875) rad = 0x40; @@ -489,8 +480,17 @@ InitKBD(InputInfoPtr pInfo, Bool init) else if (pKbd->rate >= 30) rad |= 0x00; else rad |= ((58 / pKbd->rate) - 2); pKbd->SetKbdRepeat(pInfo, rad); - } else + } else { UpdateLeds(pInfo); + if (pKbd->keyLeds & CAPSFLAG) { + pKbd->PostEvent(pInfo, KEY_CapsLock, TRUE); + pKbd->PostEvent(pInfo, KEY_CapsLock, FALSE); + } + if (pKbd->keyLeds & NUMFLAG) { + pKbd->PostEvent(pInfo, KEY_NumLock, TRUE); + pKbd->PostEvent(pInfo, KEY_NumLock, FALSE); + } + } } static int -- 1.5.4.3