qutebrowser
qutebrowser copied to clipboard
Enabling Rocker Gestures & Disabling Back Forward Mouse buttons has no effect on new QT version.
Version info: qutebrowser v3.0.0 Git commit: Backend: QtWebEngine 6.5.2, based on Chromium 108.0.5359.220 (from api) Qt: 6.5.2
Does the bug happen if you start with --temp-basedir
?:
Yes
Description
Config settings below with the following values no not apply and work:
c.input.mouse.rocker_gestures = True
c.input.mouse.back_forward_buttons = False
How to reproduce
For rocker gestures, open any webpage and click through on any link - then try the rocker gesture of holding rmb then clicking lmb. Nothing happens. Likewise, for moving forward a page holding lmb and clicking rmb also does not function.
Mouse forward and back buttons work regardless of above setting.
Reproduced with qutebrowser --qt-wrapper PyQt6 --debug --temp-basedir -s input.mouse.rocker_gestures true -s input.mouse.back_forward_buttons false
yet works fine with Qt 5.
Might be the same root cause as here:
https://github.com/qutebrowser/qutebrowser/blob/8c2e23d248e4d2150aa159ae4ac4b464bdb286cd/qutebrowser/browser/eventfilter.py#L114-L119
Might be the same root cause as here:
https://github.com/qutebrowser/qutebrowser/blob/8c2e23d248e4d2150aa159ae4ac4b464bdb286cd/qutebrowser/browser/eventfilter.py#L114-L119
This is exactly the case. Even with -s input.mouse.back_forward_buttons false
back/forward mouse buttons are still registered and result in going back/forward in history.
To fix rocker gestures manual testing confirmed that we just need to call self._mousepress_backforward()
:
diff --git a/qutebrowser/browser/eventfilter.py b/qutebrowser/browser/eventfilter.py
index 1cff11ac4..e3300168c 100644
--- a/qutebrowser/browser/eventfilter.py
+++ b/qutebrowser/browser/eventfilter.py
@@ -111,7 +111,11 @@ class TabEventFilter(QObject):
is_rocker_gesture = (config.val.input.mouse.rocker_gestures and
e.buttons() == Qt.MouseButton.LeftButton | Qt.MouseButton.RightButton)
- if e.button() in [Qt.MouseButton.XButton1, Qt.MouseButton.XButton2] or is_rocker_gesture:
+ if is_rocker_gesture:
+ self._mousepress_backforward(e)
+ return True
+
+ if e.button() in [Qt.MouseButton.XButton1, Qt.MouseButton.XButton2]:
if not machinery.IS_QT6:
self._mousepress_backforward(e)
# FIXME:qt6 For some reason, this doesn't filter the action on
I have no idea why Qt is not filtering the event for Qt.MouseButton.XButton1
or Qt.MouseButton.XButton2
, though.
@The-Compiler, do you have any starting point on how to debug this further? I'm lost right now.
// edit To be a little more specific: the comment stating that
for some reason, this doesn't filter the action on Qt 6...
still applies. Somehow, even though we return True
from eventFilter()
, Qt6 does not filter the event.
As already mentioned in https://github.com/qutebrowser/qutebrowser/issues/7853#issuecomment-1710096500, I observed the following:
Even with -s input.mouse.back_forward_buttons false back/forward mouse buttons are still registered and result in going back/forward in history.
I browsed these related parts in the code, but could not explain to myself (probably due to lack of knowledge of the inner workings of Qt's event system) why Qt would not filter the event:
- https://github.com/qutebrowser/qutebrowser/blob/b070cf45dbed27771578d98f3f4129d1f52a28f3/qutebrowser/browser/webengine/webenginetab.py#L1305-L1314
- qutebrowser/browser/eventfilter.py
I browsed these related parts in the code, but could not explain to myself (probably due to lack of knowledge of the inner workings of Qt's event system) why Qt would not filter the event: [...]
That's what I was trying to find out last time I looked at this, and I couldn't from a quick look. It'll be a few days until I get around to taking a closer look again.
I wonder if GammaRay could provide more information about how events are being propagated and such.
I got GammaRay working and attached to a qutebrowser process:
./.tox/py311-pyqt65/bin/python3 -m qutebrowser -s input.mouse.back_forward_buttons false --temp-basedir
# find pid via `ps aux | grep tox`
gammaray --pid <pid of tox>
Though I can't make too much sense out of its output:
There are two receivers of the MousePress*
events:
-
MainWindow
- some "invalid" receiver (GammaRay can't link it to a widget)
Here's mine with a locally built Qt with debug symbols. This looks like an anonymous object which I assume is a focus proxy, based on looking at other objects, but I don't know for sure. (> receiver >
means I'm showing the attributes of the "receiver" attribute of the selected object)
You should (hopefully) be able to right click and ask it to show in the Object view which goes to this for me:
As this turned out to be a little over my head, I will unassign myself and leave it up to the experts to solve this.
Unfortunately haven't gotten around to taking another look at this yet.