Cleanup: use float2, int2 types for cursor drawing callbacks

Ref !138172
This commit is contained in:
Campbell Barton
2025-05-02 23:01:29 +00:00
parent 0d6a0dfa29
commit 7d97ba4c5f
14 changed files with 82 additions and 62 deletions

View File

@@ -80,8 +80,10 @@ static PyObject *PyC_Tuple_CopySized(PyObject *src, int len_dst)
return dst;
}
static void cb_wm_cursor_draw(
bContext *C, int x, int y, float /*x_tilt*/, float /*y_tilt*/, void *customdata)
static void cb_wm_cursor_draw(bContext *C,
const blender::int2 &xy,
const blender::float2 & /*tilt*/,
void *customdata)
{
PyGILState_STATE gilstate;
bpy_context_set(C, &gilstate);
@@ -93,7 +95,7 @@ static void cb_wm_cursor_draw(
const int cb_args_len = PyTuple_GET_SIZE(cb_args);
PyObject *cb_args_xy = PyTuple_New(2);
PyTuple_SET_ITEMS(cb_args_xy, PyLong_FromLong(x), PyLong_FromLong(y));
PyTuple_SET_ITEMS(cb_args_xy, PyLong_FromLong(xy.x), PyLong_FromLong(xy.y));
PyObject *cb_args_with_xy = PyC_Tuple_CopySized(cb_args, cb_args_len + 1);
PyTuple_SET_ITEM(cb_args_with_xy, cb_args_len, cb_args_xy);