Drag and drop 2.5 integration! Finally, slashdot regulars can use
[blender-staging.git] / source / blender / windowmanager / intern / wm_cursors.c
index 6145871f9d40b4183cb7e10631b6968f61f02e28..f23688404b1428df027a9f20fe7bc0e7279d92ca 100644 (file)
@@ -64,6 +64,7 @@ static GHOST_TStandardCursor convert_cursor(int curs)
                case CURSOR_X_MOVE:             return GHOST_kStandardCursorLeftRight;
                case CURSOR_Y_MOVE:             return GHOST_kStandardCursorUpDown;
                case CURSOR_PENCIL:             return GHOST_kStandardCursorPencil;
+               case CURSOR_COPY:               return GHOST_kStandardCursorCopy;
        }
 }
 
@@ -136,9 +137,10 @@ void WM_cursor_set(wmWindow *win, int curs)
 
 void WM_cursor_modal(wmWindow *win, int val)
 {
-       if(win->lastcursor == 0)
+       if(win->lastcursor == 0) {
                win->lastcursor = win->cursor;
-       WM_cursor_set(win, val);
+               WM_cursor_set(win, val);
+       }
 }
 
 void WM_cursor_restore(wmWindow *win)
@@ -172,13 +174,16 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
 
        if(hide)                mode = GHOST_kGrabHide;
        else if(wrap)   mode = GHOST_kGrabWrap;
-
        if ((G.f & G_DEBUG) == 0) {
                if (win && win->ghostwin) {
                        const GHOST_TabletData *tabletdata= GHOST_GetTabletData(win->ghostwin);
-                       
-                       if ((tabletdata) && (tabletdata->Active == GHOST_kTabletModeNone))
+                       // Note: There is no tabletdata on Windows if no tablet device is connected.
+                       if (!tabletdata)
+                               GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
+                       else if (tabletdata->Active == GHOST_kTabletModeNone)
                                GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
+
+                       win->grabcursor = mode;
                }
        }
 }
@@ -186,8 +191,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 = GHOST_kGrabDisable;
+               }
        }
 }
 
@@ -211,7 +218,7 @@ void WM_timecursor(wmWindow *win, int nr)
        unsigned char bitmap[16][2];
        int i, idx;
        
-       if(win->lastcursor != 0)
+       if(win->lastcursor == 0)
                win->lastcursor= win->cursor; 
        
        memset(&bitmap, 0x00, sizeof(bitmap));