[mythtv] Shift key ignored in shortcuts

Michael T. Dean mtdean at thirdcontact.com
Mon Oct 27 17:20:16 UTC 2008


On 10/27/2008 01:00 PM, Oliver Maunder wrote:
> I'm trying to set up a new remote control at the moment. It's
> recognised as a keyboard and most of the buttons send key combinations
> - e.g. Stop sends Ctrl+Shift+S, Play sends Ctrl+Shift+P.
>
> The problem is, any key combination containing Shift is ignored. Ctrl
> or Alt are fine. I looked in the code and found this in
> libs/libmythui/mythmainwindow.cpp:
>
>
> // Make keynum in QKeyEvent be equivalent to what's in QKeySequence
> int MythMainWindowPrivate::TranslateKeyNum(QKeyEvent* e)
> {
>   int keynum = e->key();
>
>   if (keynum != Qt::Key_Escape && (keynum <  Qt::Key_Shift || keynum >
> Qt::Key_ScrollLock))
>   {
>      Qt::ButtonState modifiers;
>      // if modifiers have been pressed, rebuild keynum
>      if ((modifiers = e->state()) != 0)
>      {
>         int modnum = (((modifiers & Qt::ShiftButton) &&
>                              keynum > 0x7f) ? Qt::SHIFT : 0) |
>                              ((modifiers & Qt::ControlButton) ? Qt::CTRL : 0) |
>                              ((modifiers & Qt::MetaButton) ? Qt::META : 0) |
>                              ((modifiers & Qt::AltButton) ? Qt::ALT : 0);
>         modnum &= ~Qt::UNICODE_ACCEL;
>         return (keynum |= modnum);
>      }
>   }
>
>   return keynum;
> }
>
> So, if the keycode is less than 0x7f the shift modifier is ignored.
> According to the docs at [1] all the ASCII characters are in the range
> 0x20 to 0x7e, so that > 0x7f excludes pretty much any key you'd want
> to use in a shortcut!
>
> Does anyone know the logic behind this? If no-one comes up with any
> good justifications I'll raise a bug.

TTBOMK, the keybindings and jumppoints in Myth have always been "case 
insensitive," meaning that Ctrl+s is equivalent to Ctrl+S (which is 
Ctrl+Shift+s).

Mike


More information about the mythtv-dev mailing list