Custom cursor draw function uses the real cursor position when cursor is grabbed (and not the coordinates from the event). Drawing a custom cursor anywhere but on the real cursor is no good.

Also permit NULL poll function (equal to a function that always returns 1)
This commit is contained in:
Martin Poirier 2009-12-07 18:08:19 +00:00
parent 78f87c8bdf
commit 19aab8edb0

View File

@ -72,9 +72,15 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
if(screen->subwinactive == ar->swinid) {
for(pc= wm->paintcursors.first; pc; pc= pc->next) {
if(pc->poll(C)) {
if(pc->poll == NULL || pc->poll(C)) {
ARegion *ar= CTX_wm_region(C);
pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin, pc->customdata);
if (win->grabcursor) {
int x = 0, y = 0;
wm_get_cursor_position(win, &x, &y);
pc->draw(C, x - ar->winrct.xmin, y - ar->winrct.ymin, pc->customdata);
} else {
pc->draw(C, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin, pc->customdata);
}
}
}
}