Ticket #13234: 20180725_1646_long_press_back_and_jumppoints.patch

File 20180725_1646_long_press_back_and_jumppoints.patch, 1.9 KB (added by Peter Bennett, 3 years ago)

Fix long press back and jumppoints

  • mythtv/libs/libmythui/mythmainwindow.cpp

    diff --git a/mythtv/libs/libmythui/mythmainwindow.cpp b/mythtv/libs/libmythui/mythmainwindow.cpp
    index e9976cf7f40..fd786dd9730 100644
    a b bool MythMainWindow::keyLongPressFilter(QEvent **e, 
    21762176    if (!ke)
    21772177        return false;
    21782178    int keycode = ke->key();
     2179    // Ignore unknown key codes
     2180    if (keycode == 0)
     2181        return false;
    21792182
    21802183    switch ((*e)->type())
    21812184    {
    21822185        case QEvent::KeyPress:
    21832186        {
    21842187            // Check if we are in the middle of a long press
    2185             if (keycode != 0 && keycode == d->m_longPressKeyCode)
     2188            if (keycode == d->m_longPressKeyCode)
    21862189            {
    21872190                if (ke->timestamp() - d->m_longPressTime < LONGPRESS_INTERVAL
    21882191                    || d->m_longPressTime == 0)
    bool MythMainWindow::keyLongPressFilter(QEvent **e, 
    22032206                    return false;
    22042207                }
    22052208            }
     2209            // If we got a keycode different from the long press keycode it
     2210            // may have been injected by a jump point. Ignore it.
     2211            if (d->m_longPressKeyCode != 0)
     2212                return false;
     2213
     2214            // Process start of possible new long press.
    22062215            d->m_longPressKeyCode = 0;
    22072216            QStringList actions;
    22082217            bool handled = TranslateKeyPress("Long Press",
    bool MythMainWindow::keyLongPressFilter(QEvent **e, 
    22262235        }
    22272236        case QEvent::KeyRelease:
    22282237        {
    2229             if (keycode != 0 && keycode == d->m_longPressKeyCode)
     2238            if (keycode == d->m_longPressKeyCode)
    22302239            {
    22312240                if (ke->isAutoRepeat())
    22322241                    return true;
    bool MythMainWindow::eventFilter(QObject *, QEvent *e) 
    22712280
    22722281    QScopedPointer<QEvent> sNewEvent(NULL);
    22732282    if (keyLongPressFilter(&e, sNewEvent))
    2274         return false;
     2283        return true;
    22752284
    22762285    switch (e->type())
    22772286    {