diff --git a/lib/matplotlib/backends/backend_macosx.py b/lib/matplotlib/backends/backend_macosx.py index 6f831cf2172c..08cdeb73c2d9 100644 --- a/lib/matplotlib/backends/backend_macosx.py +++ b/lib/matplotlib/backends/backend_macosx.py @@ -34,10 +34,6 @@ def __init__(self, figure): self._draw_pending = False self._is_drawing = False - def set_cursor(self, cursor): - # docstring inherited - _macosx.set_cursor(cursor) - def draw(self): """Render the figure and update the macosx canvas.""" # The renderer draw is done here; delaying causes problems with code diff --git a/src/_macosx.m b/src/_macosx.m index ce5bb51d9e76..943125092e54 100755 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -361,6 +361,25 @@ static CGFloat _get_device_scale(CGContextRef cr) Py_RETURN_NONE; } +static PyObject* +FigureCanvas_set_cursor(PyObject* unused, PyObject* args) +{ + int i; + if (!PyArg_ParseTuple(args, "i", &i)) { return NULL; } + switch (i) { + case 1: [[NSCursor arrowCursor] set]; break; + case 2: [[NSCursor pointingHandCursor] set]; break; + case 3: [[NSCursor crosshairCursor] set]; break; + case 4: [[NSCursor openHandCursor] set]; break; + /* OSX handles busy state itself so no need to set a cursor here */ + case 5: break; + case 6: [[NSCursor resizeLeftRightCursor] set]; break; + case 7: [[NSCursor resizeUpDownCursor] set]; break; + default: return NULL; + } + Py_RETURN_NONE; +} + static PyObject* FigureCanvas_set_rubberband(FigureCanvas* self, PyObject *args) { @@ -489,14 +508,18 @@ static CGFloat _get_device_scale(CGContextRef cr) (PyCFunction)FigureCanvas_flush_events, METH_NOARGS, NULL}, // docstring inherited + {"set_cursor", + (PyCFunction)FigureCanvas_set_cursor, + METH_VARARGS, + "Set the active cursor."}, {"set_rubberband", (PyCFunction)FigureCanvas_set_rubberband, METH_VARARGS, - "Specifies a new rubberband rectangle and invalidates it."}, + "Specify a new rubberband rectangle and invalidate it."}, {"remove_rubberband", (PyCFunction)FigureCanvas_remove_rubberband, METH_NOARGS, - "Removes the current rubberband rectangle."}, + "Remove the current rubberband rectangle."}, {"start_event_loop", (PyCFunction)FigureCanvas_start_event_loop, METH_KEYWORDS | METH_VARARGS, @@ -1020,25 +1043,6 @@ -(void)save_figure:(id)sender { gil_call_method(toolbar, "save_figure"); } Py_RETURN_NONE; } -static PyObject* -set_cursor(PyObject* unused, PyObject* args) -{ - int i; - if (!PyArg_ParseTuple(args, "i", &i)) { return NULL; } - switch (i) { - case 1: [[NSCursor arrowCursor] set]; break; - case 2: [[NSCursor pointingHandCursor] set]; break; - case 3: [[NSCursor crosshairCursor] set]; break; - case 4: [[NSCursor openHandCursor] set]; break; - /* OSX handles busy state itself so no need to set a cursor here */ - case 5: break; - case 6: [[NSCursor resizeLeftRightCursor] set]; break; - case 7: [[NSCursor resizeUpDownCursor] set]; break; - default: return NULL; - } - Py_RETURN_NONE; -} - @implementation WindowServerConnectionManager static WindowServerConnectionManager *sharedWindowServerConnectionManager = nil; @@ -1916,10 +1920,6 @@ static void context_cleanup(const void* info) (PyCFunction)choose_save_file, METH_VARARGS, "Query the user for a location where to save a file."}, - {"set_cursor", - (PyCFunction)set_cursor, - METH_VARARGS, - "Set the active cursor."}, {} /* Sentinel */ }, };