[vdr] [PATCH] tolerate k_Repeat in cMenuEditStrItem::ProcessKey()

Marko Mäkelä marko.makela at hut.fi
Sat Apr 22 18:10:11 CEST 2006


On Sun, Apr 09, 2006 at 10:38:06PM +0300, Marko Mäkelä wrote:
> For instance, when I start editing the string "Euronews" by pressing the Right
> button in the "Edit timer" menu, it will display as follows:
> 
> Right->
>  [E]uronews
> 2->
>  [A]uronews
> 2->
>  Au[a]onews
> 
> If I keep a longer pause between the two keypresses of the button "2",
> the string will change to "Aaronews".

This is because my RCU (the new Hauppauge RCU) erroneously will not flip
the RC5 toggle bit when the button is pressed in rapid succession.
Also, the unpatched cx88-input.c in Linux 2.6.x (where 12<=x<=16) would
map rapidly arriving key-press events to key-repeat.

The fix is simple:

--- menuitems.c.orig    2006-04-22 18:51:36.000000000 +0300
+++ menuitems.c 2006-04-22 19:04:00.000000000 +0300
@@ -351,7 +351,7 @@ char cMenuEditStrItem::Inc(char c, bool

 eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
 {
-  bool SameKey = Key == lastKey;
+  bool SameKey = !((Key ^ lastKey) & ~k_Repeat);
   if (Key != kNone)
      lastKey = Key;
   else if (!newchar && k0 <= NORMALKEY(lastKey) && NORMALKEY(lastKey) <= k9 && autoAdvanceTimeout.TimedOut()) {
@@ -460,7 +460,7 @@ eOSState cMenuEditStrItem::ProcessKey(eK
                        }
                     if (!currentChar || !*currentChar || *currentChar == '\t') {
                        // find the beginning of the character map entry for Key-                       int n = Key - k0;
+                       int n = NORMALKEY(Key) - k0;
                        currentChar = charMap;
                        while (n > 0 && *currentChar) {
                              if (*currentChar++ == '\t')

Without the second patch, the k0..k9|k_Repeat event would be ignored when
*currentChar=='\t' is reached.

	Marko



More information about the vdr mailing list