Skip to content

Commit

Permalink
Backport PR matplotlib#29097: ENH: add back/forward buttons to osx ba…
Browse files Browse the repository at this point in the history
…ckend move
  • Loading branch information
greglucas authored and meeseeksmachine committed Nov 7, 2024
1 parent ef8f804 commit cebc940
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,13 @@ bool mpl_check_button(bool present, PyObject* set, char const* name) {
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject* set = NULL;
NSUInteger buttons = [NSEvent pressedMouseButtons];

if (!(set = PySet_New(NULL))
|| mpl_check_button(buttons & (1 << 0), set, "LEFT")
|| mpl_check_button(buttons & (1 << 1), set, "RIGHT")
|| mpl_check_button(buttons & (1 << 2), set, "MIDDLE")) {
|| mpl_check_button(buttons & (1 << 2), set, "MIDDLE")
|| mpl_check_button(buttons & (1 << 3), set, "BACK")
|| mpl_check_button(buttons & (1 << 4), set, "FORWARD")) {
Py_CLEAR(set); // On failure, return NULL with an exception set.
}
PyGILState_Release(gstate);
Expand Down

0 comments on commit cebc940

Please sign in to comment.