[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25177] trunk/blender/source/blender/ windowmanager/intern/wm_draw.c: Custom cursor draw function uses the real cursor position when cursor is grabbed (and not the coordinates from the event).

Martin Poirier theeth at yahoo.com
Mon Dec 7 19:08:19 CET 2009


Revision: 25177
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25177
Author:   theeth
Date:     2009-12-07 19:08:19 +0100 (Mon, 07 Dec 2009)

Log Message:
-----------
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)

Modified Paths:
--------------
    trunk/blender/source/blender/windowmanager/intern/wm_draw.c

Modified: trunk/blender/source/blender/windowmanager/intern/wm_draw.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_draw.c	2009-12-07 18:06:37 UTC (rev 25176)
+++ trunk/blender/source/blender/windowmanager/intern/wm_draw.c	2009-12-07 18:08:19 UTC (rev 25177)
@@ -72,9 +72,15 @@
 
 		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);
+					}
 				}
 			}
 		}





More information about the Bf-blender-cvs mailing list