WM: minor changes to cursor API

This commit is contained in:
2018-10-25 15:18:24 +11:00
parent c9e36e5434
commit 2046817c08
2 changed files with 14 additions and 5 deletions

View File

@@ -55,6 +55,7 @@ struct wmGesture;
struct wmJob; struct wmJob;
struct wmOperatorType; struct wmOperatorType;
struct wmOperator; struct wmOperator;
struct wmPaintCursor;
struct rcti; struct rcti;
struct PointerRNA; struct PointerRNA;
struct PropertyRNA; struct PropertyRNA;
@@ -133,15 +134,17 @@ void WM_cursor_grab_enable(struct wmWindow *win, bool wrap, bool hide, int boun
void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]); void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]);
void WM_cursor_time (struct wmWindow *win, int nr); void WM_cursor_time (struct wmWindow *win, int nr);
void *WM_paint_cursor_activate( struct wmPaintCursor *WM_paint_cursor_activate(
struct wmWindowManager *wm, struct wmWindowManager *wm,
bool (*poll)(struct bContext *C), bool (*poll)(struct bContext *C),
void (*draw)(struct bContext *C, int, int, void *customdata), void (*draw)(struct bContext *C, int, int, void *customdata),
void *customdata); void *customdata);
void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle); bool WM_paint_cursor_end(struct wmWindowManager *wm, struct wmPaintCursor *handle);
void *WM_paint_cursor_customdata_get(struct wmPaintCursor *pc);
void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar); void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar);
void WM_cursor_warp (struct wmWindow *win, int x, int y); void WM_cursor_warp (struct wmWindow *win, int x, int y);
void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y); void WM_cursor_compatible_xy(wmWindow *win, int *x, int *y);
float WM_cursor_pressure (const struct wmWindow *win); float WM_cursor_pressure (const struct wmWindow *win);

View File

@@ -1813,7 +1813,7 @@ static void WM_OT_console_toggle(wmOperatorType *ot)
* - draw(bContext): drawing callback for paint cursor * - draw(bContext): drawing callback for paint cursor
*/ */
void *WM_paint_cursor_activate( wmPaintCursor *WM_paint_cursor_activate(
wmWindowManager *wm, bool (*poll)(bContext *C), wmWindowManager *wm, bool (*poll)(bContext *C),
wmPaintCursorDraw draw, void *customdata) wmPaintCursorDraw draw, void *customdata)
{ {
@@ -1828,7 +1828,7 @@ void *WM_paint_cursor_activate(
return pc; return pc;
} }
void WM_paint_cursor_end(wmWindowManager *wm, void *handle) bool WM_paint_cursor_end(wmWindowManager *wm, wmPaintCursor *handle)
{ {
wmPaintCursor *pc; wmPaintCursor *pc;
@@ -1836,9 +1836,15 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
if (pc == (wmPaintCursor *)handle) { if (pc == (wmPaintCursor *)handle) {
BLI_remlink(&wm->paintcursors, pc); BLI_remlink(&wm->paintcursors, pc);
MEM_freeN(pc); MEM_freeN(pc);
return; return true;
} }
} }
return false;
}
void *WM_paint_cursor_customdata_get(wmPaintCursor *pc)
{
return pc->customdata;
} }
/* *********************** radial control ****************** */ /* *********************** radial control ****************** */