Opened 14 years ago

Closed 14 years ago

#409 closed defect (invalid)

Support for modifier keys from lirc

Reported by: mythtv@… Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version: 0.18.1
Severity: medium Keywords: lirc
Cc: Ticket locked: no

Description

Under a newly built mythtv (0.18.1-1 from Gentoo), modifier keys are ignored. A look at libs/libmyth/mythdialogs.cpp shows that mod is defined as k & MODIFIER_KEYS. MODIFIER_KEYS is #defined as 0x00f0000. The result is passed to QKeyEvent as "state", which is apparently stored as a SHORT, killing any bits that were set.

As a result, saying that "Play" should be "Ctrl+P" results in tv_play getting a QKeyEvent of "P" with state = 0.

Before I propose my fix, let me point out that I'm not familiar with what UNICODE_ACCEL means. That said, here's my proposed patch, which converts the MODIFIER_KEY bits into the Qt namespace, which is apparently what MythMainWindowPrivate::TranslateKeyNum? expects anyway. This may be an appropriate thing to do in any case.

--- libs/libmyth/mythdialogs.cpp        2005-04-01 15:18:40.000000000 -0500
+++ ../../mythtv-0.18.1/libs/libmyth/mythdialogs.cpp    2005-10-02 10:25:34.000000000 -0400
@@ -733,6 +799,13 @@
                 QChar c(k & ~UNICODE_ACCEL);
                 ascii = c.latin1();
                 text = QString(c);
+
+               int m = 0;
+               if (mod & CTRL) m |= Qt::ControlButton;
+               if (mod & SHIFT) m |= Qt::ShiftButton;
+               if (mod & ALT) m |= Qt::AltButton;
+               if (mod & META) m |= Qt::MetaButton;
+               mod = m;
             }
 
             QKeyEvent key(lke->isKeyDown() ? QEvent::KeyPress :

Change History (2)

comment:1 Changed 14 years ago by anonymous

Pretty certain this was fixed in SVN months back. 0.18 is nearly six months old!!

comment:2 Changed 14 years ago by mythtv@…

Resolution: invalid
Status: newclosed

Not certain how I missed that, but, yes, I see effectively my proposed "fix" is in trunk (outside UNICODE_ACCEL).

I did check, but checked wrong. I am happily surprised to see that I did almost exactly the right thing.

Sorry for the dupe.

Note: See TracTickets for help on using tickets.