Skip to content
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
127 changes: 6 additions & 121 deletions src/_macosx.m
Original file line number Diff line number Diff line change
Expand Up @@ -1885,127 +1885,12 @@ - (void)mouseDragged:(NSEvent *)event
PyGILState_Release(gstate);
}

- (void)rightMouseDown:(NSEvent *)event
{
int x, y;
int num = 3;
int dblclick = 0;
PyObject* result;
PyGILState_STATE gstate;
NSPoint location = [event locationInWindow];
location = [self convertPoint: location fromView: nil];
x = location.x * device_scale;
y = location.y * device_scale;
gstate = PyGILState_Ensure();
if ([event clickCount] == 2) {
dblclick = 1;
}
result = PyObject_CallMethod(canvas, "button_press_event", "iiii", x, y, num, dblclick);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}

- (void)rightMouseUp:(NSEvent *)event
{
int x, y;
int num = 3;
PyObject* result;
PyGILState_STATE gstate;
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, "button_release_event", "iii", x, y, num);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}

- (void)rightMouseDragged:(NSEvent *)event
{
int x, y;
NSPoint location = [event locationInWindow];
location = [self convertPoint: location fromView: nil];
x = location.x * device_scale;
y = location.y * device_scale;
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}

- (void)otherMouseDown:(NSEvent *)event
{
int x, y;
int num = 2;
int dblclick = 0;
PyObject* result;
PyGILState_STATE gstate;
NSPoint location = [event locationInWindow];
location = [self convertPoint: location fromView: nil];
x = location.x * device_scale;
y = location.y * device_scale;
gstate = PyGILState_Ensure();
if ([event clickCount] == 2) {
dblclick = 1;
}
result = PyObject_CallMethod(canvas, "button_press_event", "iiii", x, y, num, dblclick);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}

- (void)otherMouseUp:(NSEvent *)event
{
int x, y;
int num = 2;
PyObject* result;
PyGILState_STATE gstate;
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, "button_release_event", "iii", x, y, num);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}

- (void)otherMouseDragged:(NSEvent *)event
{
int x, y;
NSPoint location = [event locationInWindow];
location = [self convertPoint: location fromView: nil];
x = location.x * device_scale;
y = location.y * device_scale;
PyGILState_STATE gstate = PyGILState_Ensure();
PyObject* result = PyObject_CallMethod(canvas, "motion_notify_event", "ii", x, y);
if(result)
Py_DECREF(result);
else
PyErr_Print();

PyGILState_Release(gstate);
}
- (void)rightMouseDown:(NSEvent *)event { [self mouseDown: event]; }
- (void)rightMouseUp:(NSEvent *)event { [self mouseUp: event]; }
- (void)rightMouseDragged:(NSEvent *)event { [self mouseDragged: event]; }
- (void)otherMouseDown:(NSEvent *)event { [self mouseDown: event]; }
- (void)otherMouseUp:(NSEvent *)event { [self mouseUp: event]; }
- (void)otherMouseDragged:(NSEvent *)event { [self mouseDragged: event]; }

- (void)setRubberband:(NSRect)rect
{
Expand Down