[mythtv] Control keys don't work from lircrc

Michael Carland mcarland at bitsgonewild.net
Sat May 28 03:48:06 UTC 2005


Hi,

I'm looking for advice on whether I am going about fixing this the 
right way before I send in a patch.

Following the tips in the MythWeb page to change key bindings, I used a 
control key combo to map a jump point for MythWeather (Ctrl+W). I was 
unable to get this working from lirc using \W (how lirc docs say to 
send a ctrl-W), or any of {Ctrl | CTRL | Control | CONTROL}{-   +}W.

I looked into it, and it looks like MythMainWindow::customEvent, when 
handling kLircKeycodeEventType, creates a QKeyEvent with modifiers like 
Qt:CTRL, Qt:META, Qt:ALT (Qt::Modifier) in the state field, but 
QKeyEvent only recognizes (and retains) modifiers like 
Qt::ControlButton, Qt:MetaButton, Qt::AltButton (Qt::ButtonState), so 
the modifiers are lost.

I added the following code:

             mod = ((mod & Qt::CTRL) ? Qt::ControlButton : 0) |
                   ((mod & Qt::META) ? Qt::MetaButton : 0) |
                   ((mod & Qt::ALT) ? Qt::AltButton : 0) |
                   ((mod & Qt::SHIFT) ? Qt::ShiftButton : 0);

before the QKeyEvent is created, and the control key now works for the 
remote.

Is this the right thing to do?

-Michael



More information about the mythtv-dev mailing list