Skip to content
Snippets Groups Projects

qt/interface_window_handler: Add filtering for hotkeys

Merged Benjamin Arnaud requested to merge bunjee/vlc:ci-bug into master

This MR adds proper key filtering to make sure we are not missing hotkeys when a QQuickControl has the mouse focus.

  • When the player is hidden, keyboard navigation fully works (left, right, up, down).
  • When the player is visible we make sure the QML never grabs navigation keys and we forward them as hotkey(s) to the player. It means we have to use tab and backtab to navigate through the QML player controls.

This MR is based on @fuzun's proposal here: #26203 (comment 291417)

fix #26203 (closed)

Edited by Benjamin Arnaud

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Benjamin Arnaud changed the description

    changed the description

  • added 1 commit

    • b79afdda - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

  • Benjamin Arnaud added 58 commits

    added 58 commits

    • b79afdda...34e92dd3 - 55 commits from branch videolan:master
    • 2a88c724 - qt/compositor(s): Add activeFocusItem getter
    • 6ee05df1 - qt/main_interface: Make sendHotkey public
    • f27786f9 - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

  • Benjamin Arnaud added 3 commits

    added 3 commits

    • 2a232679 - qt/compositor(s): Add activeFocusItem getter
    • b757e907 - qt/main_interface: Make sendHotkey public
    • b36897e6 - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

  • Pierre Lamot changed milestone to %4.0

    changed milestone to %4.0

  • Benjamin Arnaud added 3 commits

    added 3 commits

    • c51aea69 - qt/compositor(s): Add activeFocusItem getter
    • cf214941 - qt/main_interface: Make sendHotkey public
    • e69e7a2b - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

    • Author Reporter
      Resolved by Benjamin Arnaud

      Here is an update on this. We tried to subclass the Quick Control(s) to do the following:

      ControlVlc {
          Keys.onPressed: if (visualFocus) event.accepted = true
      }

      Thus trying to repropagate the key event(s) when the item has no visual focus (aka keyboard focus). Unfortunately the QQuickAbstractButton implementation is like this:

      void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
      {
          Q_D(QQuickAbstractButton);
          QQuickControl::keyPressEvent(event);
          if (d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) {
              d->setPressPoint(QPoint(qRound(width() / 2), qRound(height() / 2)));
              setPressed(true);
              if (d->autoRepeat)
                  d->startRepeatDelay();
              emit pressed();
              event->accept();
          }
      }
      //...
      bool QQuickAbstractButtonPrivate::acceptKeyClick(Qt::Key key) const
      {
          return key == Qt::Key_Space;
      }

      So we tried another route following @fuzun's suggestion and adding filtering for hotkeys in interface_window_handler. Unfortunately, this defeats navigation keys for the Qml UI because we're prioritizing the player via sendHotkey. At the moment the filtering solution is the closest to what we would like to achieve.

      Alternatively, we could have a different hotkey mode when entering the player view, thus enabling key navigation when browsing the MediaLibrary.

      @chub @jagannatharjun @fuzun, would you let me know your opinion on this or whether you have another solution to propose ?

      Thanks a bunch.

      Edited by Benjamin Arnaud
  • Benjamin Arnaud added 440 commits

    added 440 commits

    • e69e7a2b...4c2ca682 - 437 commits from branch videolan:master
    • f32950c3 - qt/compositor(s): Add activeFocusItem getter
    • bd53ec1f - qt/main_interface: Make sendHotkey public
    • d705f960 - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

  • added 1 commit

    • 948a0b49 - qt/interface_window_handler: Add filtering for hotkeys

    Compare with previous version

  • Benjamin Arnaud added 32 commits

    added 32 commits

    • 948a0b49...90f8b8a8 - 27 commits from branch videolan:master
    • e2938e69 - qt/compositor(s): Add activeFocusItem getter
    • 94fd5801 - qt/mainctx: Add the 'filterHotkeys' property
    • f9e268b6 - qt/main_interface: Make sendHotkey public
    • 02aefc37 - qt/interface_window_handler: Add filtering for hotkeys
    • 967dab78 - qml/Player: Add 'filterHotkeys' implementation

    Compare with previous version

  • Benjamin Arnaud changed the description

    changed the description

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading