-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix up some OSX backend issues #12053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
attn: @astrofrog |
Anyone wanting to check me on the API calls can check out the docs here. |
src/_macosx.m
Outdated
gstate = PyGILState_Ensure(); | ||
result = PyObject_CallMethod(canvas, "enter_notify_event", ""); | ||
PyObject* loc = Py_BuildValue("ii", x, y); | ||
Py_INCREF(Py_None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just borrow the ref to None (i.e. don't bother with Py_INCREF/Py_DECREF)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that because we're staying inside our function? I know we have to inc ref when returning (or use Py_RETURN_NONE
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
src/_macosx.m
Outdated
PyObject* loc = Py_BuildValue("ii", x, y); | ||
Py_INCREF(Py_None); | ||
result = PyObject_CallMethod(canvas, "enter_notify_event", "OO", | ||
Py_None, loc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think something like
result = PyObject_CallMethod(canvas, "enter_notify_event", "O(ii)", Py_None, x, y);
should work(?) and save you from bothering with loc and its refcounting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's a new one.
Fixes deprecation warning by adding needed event information.
…#11985) One of the arugments when creating a timer on OSX is the time of first fire. We were passing 0, which puts the time in the past, which means it fires as soon as possible. Change to calculate what that time should be.
698e53e
to
ceb3e50
Compare
Well that simplifies the one commit significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! I just tested this on OS 10.9.5 and works great - no deprecation warning from #10948, and the timer event fires after 5 seconds like its supposed to from @astrofrog's example in #11985
@dopplershift - thanks for the timer fix! |
Thanks @dopplershift! |
…053-on-v3.0.x Backport PR #12053 on branch v3.0.x (Fix up some OSX backend issues)
This fixes up a few issues in the OSX backend:
enter_notify_event
. Added position information (this would have been much easier if this event wasn't the only one that takes position as a tuple). Liberally borrowed code used in other event handlers in OSX backend. Fixes OSX backend raises deprecation warning for enter_notify_event #10948.