[vlc-commits] [Git][videolan/vlc][master] qml: prevent delivering input events to items outside the viewport in views
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Jun 8 09:08:40 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
80d7c0aa by Fatih Uzunoglu at 2026-06-08T08:25:33+00:00
qml: prevent delivering input events to items outside the viewport in views
In some cases we do not want to do `clip: true` for several reasons:
- We don't want to have clipping effect (relevant in main display
views because the exceeding part may be used as a source for the
backdrop blur effect that covers the background of mini player).
- Clipping is already done by other means, such as item layering,
which is relevant with the `FadingEdge` effect, for example.
However, if the content is clipped, we need to ensure that the
items are not delivered to the items that are not (partially or
fully) painted. Qt handles this automatically with `clip: true`,
but in other cases we need to have a workaround.
Here, I propose setting this flag regardless whether there is
actually clipping done or not. Even if there is no clipping,
it is not conventional for the events to be delivered to the
children that are outside the viewport of the view. In fact,
we had to come up with other workarounds for this before for
the main display views (such as filtering input events in
mini player background explicitly, until it was no longer
necessary (8656cbde)).
- - - - -
2 changed files:
- modules/gui/qt/widgets/qml/ExpandGridView.qml
- modules/gui/qt/widgets/qml/ListViewExt.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -180,11 +180,24 @@ FocusScope {
activeFocusOnTab: true
+ function _useClipRectForEventDeliveryWorkaround() {
+ if (!root.clip) {
+ // The following flag makes sure that the event delivery agent
+ // does not deliver the input events to the children of the
+ // content item that are outside of the viewport, without
+ // clipping the content with a clip node:
+ MainCtx.setItemFlag(root, Item.ItemClipsChildrenToShape)
+ }
+ }
+
// Events
Component.onCompleted: {
if (_initialize())
flickable.layout(true)
+
+ clipChanged.connect(root, root._useClipRectForEventDeliveryWorkaround)
+ root._useClipRectForEventDeliveryWorkaround()
}
// view needs to be relayout, since items may move
=====================================
modules/gui/qt/widgets/qml/ListViewExt.qml
=====================================
@@ -350,6 +350,16 @@ ListView {
removeDisplaced: moveDisplaced
+ function _useClipRectForEventDeliveryWorkaround() {
+ if (!root.clip) {
+ // The following flag makes sure that the event delivery agent
+ // does not deliver the input events to the children of the
+ // content item that are outside of the viewport, without
+ // clipping the content with a clip node:
+ MainCtx.setItemFlag(root, Item.ItemClipsChildrenToShape)
+ }
+ }
+
// Events
Component.onCompleted: {
@@ -358,6 +368,9 @@ ListView {
// feature for non-touch cases, so disable it here and enable
// it if touch is detected through the hover handler:
MainCtx.setFiltersChildMouseEvents(root, false)
+
+ clipChanged.connect(root, root._useClipRectForEventDeliveryWorkaround)
+ root._useClipRectForEventDeliveryWorkaround()
}
HoverHandler {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80d7c0aa8e86c0193b7048836d1aacdfd44f8896
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80d7c0aa8e86c0193b7048836d1aacdfd44f8896
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list