Bug summary
Run the attached code with the qtagg as well as the macosx backends.
While the mouse cursor is over the figure, perform the following:
- Click mouse. Release mouse
- Hold Option: Click mouse. Release mouse.
- Hold Control: Click mouse. Release mouse.
Code for reproduction
import matplotlib.pyplot as plt
def on_button_press(event):
print(f'button press: {event.button}')
def on_button_release(event):
print(f'button release: {event.button}')
fig = plt.figure()
fig.canvas.mpl_connect('button_press_event', on_button_press)
fig.canvas.mpl_connect('button_release_event', on_button_release)
plt.show()
Actual outcome
qtagg:
button press: 1
button release: 1
button press: 1
button release: 1
button press: 3
button release: 3
macosx:
button press: 1
button release: 1
button press: 2
button release: 1
button press: 3
button release: 1
Expected outcome
Based on these code comments in _macosx.m:
if (modifier & NSEventModifierFlagControl)
/* emulate a right-button click */
button = 3;
else if (modifier & NSEventModifierFlagOption)
/* emulate a middle-button click */
button = 2;
I would expect:
button press: 1
button release: 1
button press: 2
button release: 2
button press: 3
button release: 3
However, if alt+click should not result in "middle click", I would expect macosx to match qtagg.
Additional information
No response
Operating system
macOS 14.8.5
Matplotlib Version
dev
Matplotlib Backend
qtagg, macosx
Python version
3.14.5
Jupyter version
No response
Installation
None
Bug summary
Run the attached code with the qtagg as well as the macosx backends.
While the mouse cursor is over the figure, perform the following:
Code for reproduction
Actual outcome
qtagg:
macosx:
Expected outcome
Based on these code comments in
_macosx.m:I would expect:
However, if alt+click should not result in "middle click", I would expect macosx to match qtagg.
Additional information
No response
Operating system
macOS 14.8.5
Matplotlib Version
dev
Matplotlib Backend
qtagg, macosx
Python version
3.14.5
Jupyter version
No response
Installation
None