[mythtv] [patch] Fixes lirc problem with edit boxes

Mikael Magnusson mikaelmagnusson at tjohoo.se
Sun Sep 7 17:34:40 EDT 2003


On Sun, Sep 07, 2003 at 08:52:16AM -0400, Gregory McLean wrote:
> thor wrote:
> >On Saturday 06 September 2003 02:50 pm, thor wrote:
> >
> >>On Saturday 06 September 2003 02:43 pm, Gregory McLean wrote:
> >>
> >>>I'd like to fix this but frankly I'm stumped.
> >>
> >>	I've just noticed in the past day or so that the password/pin dialog
> >>sometimes doesn't notice key presses (even at the keyboard). I should have
> >>a fix in shortly (as soon as I figure out how I screwed up).
> >
> >
> >	This is now fixed in CVS (I think). Can you try it again?
> I did a quick rebuild. Nope. Fresh rebuild Nope same thing. As far as I 
> can see the event is getting passed to the QT lineedit and what that is 
> doing with it is anyone's guess. (If you watch real close you can see 
> the blinking cursor in the widget 'blink' for each press)
> 
> So I guess the question becomes what is the difference between the 
> keyboard events and ones posted via the lirc code? There must be 
> something for the line edit to reject it when coming from lirc (via 
> postevent) and from the keyboard. All my prodding shows it _should_ work 
> but it don't.
> 
> Greg
> 
> 

This patch fixes issues with the key events that are constructed for 
lirc keys. Previous the ASCII and text fields were always 16. Now I 
think they are correct. It works for me anyway. But I don't know if it's 
correct to save a latin1 value in the ascii field.

Mikael
-------------- next part --------------
Index: mythdialogs.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/mythdialogs.cpp,v
retrieving revision 1.17
diff -u -u -r1.17 mythdialogs.cpp
--- mythdialogs.cpp	6 Sep 2003 20:19:43 -0000	1.17
+++ mythdialogs.cpp	7 Sep 2003 14:15:49 -0000
@@ -148,9 +148,18 @@
         {
             int mod = keycode & MODIFIER_MASK;
             int k = keycode & ~MODIFIER_MASK; /* trim off the mod */
-            QString text(QChar(k >> 24));
+            int ascii = 0;
+            QString text;
+
+            if (k & UNICODE_ACCEL)
+            {
+                QChar c(k & ~UNICODE_ACCEL);
+                ascii = c.latin1();
+                text = QString(c);
+            }
+
             QKeyEvent key(lke->isKeyDown() ? QEvent::KeyPress :
-                          QEvent::KeyRelease, k, k >> 24, mod, text);
+                          QEvent::KeyRelease, k, ascii, mod, text);
 
             QObject *key_target = getTarget(key);
 


More information about the mythtv-dev mailing list