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

Skip to content

Backport PR #12053 on branch v3.0.x (Fix up some OSX backend issues) #12080

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -1804,8 +1804,16 @@ - (void)mouseEntered:(NSEvent *)event
NSWindow* window = [self window];
if ([window isKeyWindow]==false) return;

int x, y;
NSPoint location = [event locationInWindow];
location = [self convertPoint: location fromView: nil];
x = location.x * device_scale;
y = location.y * device_scale;

gstate = PyGILState_Ensure();
result = PyObject_CallMethod(canvas, "enter_notify_event", "");
result = PyObject_CallMethod(canvas, "enter_notify_event", "O(ii)",
Py_None, x, y);

if(result)
Py_DECREF(result);
else
Expand Down Expand Up @@ -2414,6 +2422,7 @@ static void context_cleanup(const void* info)
CFRunLoopTimerRef timer;
CFRunLoopTimerContext context;
double milliseconds;
CFAbsoluteTime firstFire;
CFTimeInterval interval;
PyObject* attribute;
PyObject* failure;
Expand All @@ -2438,12 +2447,15 @@ static void context_cleanup(const void* info)
PyErr_SetString(PyExc_AttributeError, "Timer has no attribute '_single'");
return NULL;
}
// Need to tell when to first fire this timer, so get the current time
// and add an interval.
interval = milliseconds / 1000.0;
firstFire = CFAbsoluteTimeGetCurrent() + interval;
switch (PyObject_IsTrue(attribute)) {
case 1:
interval = 0;
break;
case 0:
interval = milliseconds / 1000.0;
case 0: // Set by default above
break;
case -1:
default:
Expand All @@ -2467,7 +2479,7 @@ static void context_cleanup(const void* info)
context.copyDescription = NULL;
context.info = attribute;
timer = CFRunLoopTimerCreate(kCFAllocatorDefault,
0,
firstFire,
interval,
0,
0,
Expand Down