Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit efc74ad

Browse files
authored
Merge pull request #21273 from meeseeksmachine/auto-backport-of-pr-21269-on-v3.5.x
Backport PR #21269 on branch v3.5.x (Don't use pixelDelta() on X11.)
2 parents bf77fa2 + d31e958 commit efc74ad

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/backends/backend_qt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,10 @@ def mouseReleaseEvent(self, event):
312312

313313
def wheelEvent(self, event):
314314
x, y = self.mouseEventCoords(self._get_position(event))
315-
# from QWheelEvent::delta doc
316-
if event.pixelDelta().x() == 0 and event.pixelDelta().y() == 0:
315+
# from QWheelEvent::pixelDelta doc: pixelDelta is sometimes not
316+
# provided (`isNull()`) and is unreliable on X11 ("xcb").
317+
if (event.pixelDelta().isNull()
318+
or QtWidgets.QApplication.instance().platformName() == "xcb"):
317319
steps = event.angleDelta().y() / 120
318320
else:
319321
steps = event.pixelDelta().y()

0 commit comments

Comments
 (0)