Flag down a window when cursor is grabbed.
authorMartin Poirier <theeth@yahoo.com>
Mon, 7 Dec 2009 18:05:51 +0000 (18:05 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 7 Dec 2009 18:05:51 +0000 (18:05 +0000)
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/windowmanager/intern/wm_cursors.c

index 1af1dd7a1589a28c599b72bcdb696cbc3a7059e7..24374720232f4062e4586586f2821489c1873741 100644 (file)
@@ -139,7 +139,10 @@ typedef struct wmWindow {
        
        void *ghostwin;         /* dont want to include ghost.h stuff */
        
-       int winid, pad;         /* winid also in screens, is for retrieving this window after read */
+       int winid;              /* winid also in screens, is for retrieving this window after read */
+
+       short grabcursor; /* 1 if cursor is grabbed */
+       short pad;
        
        struct bScreen *screen;         /* active screen */
        struct bScreen *newscreen;      /* temporary when switching */
index 95a1de961152cd31530e4c39e2c6829e3b3da025..cec5886014a30323e71d108168ba22f80c467611 100644 (file)
@@ -180,6 +180,8 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
                                GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
                        else if (tabletdata->Active == GHOST_kTabletModeNone)
                                GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
+
+                       win->grabcursor = 1;
                }
        }
 }
@@ -187,8 +189,10 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
 void WM_cursor_ungrab(wmWindow *win)
 {
        if ((G.f & G_DEBUG) == 0) {
-               if(win && win->ghostwin)
+               if(win && win->ghostwin) {
                        GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL);
+                       win->grabcursor = 0;
+               }
        }
 }