Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-12-07 21:08:19 +0300
committerMartin Poirier <theeth@yahoo.com>2009-12-07 21:08:19 +0300
commit19aab8edb09eaf3600e4ca90329e244554f3a0fb (patch)
treebd63c1d6f59533c8f9de892150c6d29b5e0e2727 /source
parent78f87c8bdf3bdb2115f9ab3e2a333fb76a5d2cfc (diff)
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)
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index e7c04141ad3..96aea760e20 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -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);
+ }
}
}
}