qt/interface_window_handler: Add filtering for hotkeys
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)
Merge request reports
Activity
added 1 commit
- 9ff1e5eb - qt/interface_window_handler: Add filtering for hotkeys
- Resolved by Benjamin Arnaud
added 1 commit
- b79afdda - qt/interface_window_handler: Add filtering for hotkeys
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
Toggle commit list-
b79afdda...34e92dd3 - 55 commits from branch
- Resolved by Benjamin Arnaud
- Resolved by Benjamin Arnaud
added Component::Interface: Qt label
changed milestone to %4.0
- 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
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
Toggle commit list-
e69e7a2b...4c2ca682 - 437 commits from branch
added 1 commit
- 948a0b49 - qt/interface_window_handler: Add filtering for hotkeys
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
Toggle commit list-
948a0b49...90f8b8a8 - 27 commits from branch