Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Dedupe handling of mouse buttons in macos backend.#20778

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
greglucas merged 1 commit intomatplotlib:masterfromanntzer:macosmousebutton
Aug 3, 2021
Merged
Changes fromall 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 deletionssrc/_macosx.m
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp