8000 Merge pull request #21269 from anntzer/pixeldelta · matplotlib/matplotlib@4a8d4c7 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4a8d4c7

Browse files
authored
Merge pull request #21269 from anntzer/pixeldelta
Don't use pixelDelta() on X11.
2 parents 22bf7d6 + 6d0c9a8 commit 4a8d4c7

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)
0