2.5
authorTon Roosendaal <ton@blender.org>
Mon, 15 Dec 2008 16:54:47 +0000 (16:54 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 15 Dec 2008 16:54:47 +0000 (16:54 +0000)
Mouse cursors now work again

- centralized screen-level cursor changes, no more operator
  running for it.
- spacetypes have callback to check/set individual cursor
  types. Use notifier SCREEN_CHANGED to make sure it works
  on mode changes etc.
- new calls WM_cursor_modal() and WM_cursor_restore() to
  make temporarily cursor types during modes.
- used above for view2d cursors.

12 files changed:
source/blender/blenkernel/BKE_screen.h
source/blender/editors/interface/view2d_ops.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_intern.h
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_text/space_text.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_cursors.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/wm_cursors.h

index 5a679b6475f01b2b8e35670f0ce0645e56c5939f..bb3188de5119103fb3b1e79181cea20632943dfb 100644 (file)
@@ -37,6 +37,7 @@ struct bScreen;
 struct ARegion;
 struct wmNotifier;
 struct wmWindowManager;
+struct wmWindow;
 struct ListBase;
 
 /* spacetype has everything stored to get an editor working, it gets initialized via 
@@ -69,6 +70,8 @@ typedef struct SpaceType {
        void            (*operatortypes)(void);
        /* add default items to WM keymap */
        void            (*keymap)(struct wmWindowManager *);
+       /* sets default cursor per region */
+       void            (*cursor)(struct wmWindow *win, struct ARegion *ar);
 
        /* region type definitions */
        ListBase        regiontypes;
index d84932c82feab15ac29b2a03d050c9ab647d77e3..3c9172b8a288002397a83d46a1235cd3df485584 100644 (file)
@@ -209,14 +209,12 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
        RNA_int_set(op->ptr, "deltax", 0);
        RNA_int_set(op->ptr, "deltay", 0);
        
-#if 0 // XXX - enable this when cursors are working properly
        if (v2d->keepofs & V2D_LOCKOFS_X)
-               WM_set_cursor(C, BC_NS_SCROLLCURSOR);
+               WM_cursor_modal(C->window, BC_NS_SCROLLCURSOR);
        else if (v2d->keepofs & V2D_LOCKOFS_Y)
-               WM_set_cursor(C, BC_EW_SCROLLCURSOR);
+               WM_cursor_modal(C->window, BC_EW_SCROLLCURSOR);
        else
-               WM_set_cursor(C, BC_NSEW_SCROLLCURSOR);
-#endif // XXX - enable this when cursors are working properly
+               WM_cursor_modal(C->window, BC_NSEW_SCROLLCURSOR);
        
        /* add temp handler */
        WM_event_add_modal_handler(C, &C->window->handlers, op);
@@ -251,7 +249,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
                                RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
                                
                                view_pan_exit(C, op);
-                               //WM_set_cursor(C, CURSOR_STD);         // XXX - enable this when cursors are working properly  
+                               WM_cursor_restore(C->window);
                                
                                return OPERATOR_FINISHED;
                        }
@@ -689,14 +687,12 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
        RNA_float_set(op->ptr, "deltax", 0);
        RNA_float_set(op->ptr, "deltay", 0);
        
-#if 0 // XXX - enable this when cursors are working properly
        if (v2d->keepofs & V2D_LOCKOFS_X)
-               WM_set_cursor(C, BC_NS_SCROLLCURSOR);
+               WM_cursor_modal(C->window, BC_NS_SCROLLCURSOR);
        else if (v2d->keepofs & V2D_LOCKOFS_Y)
-               WM_set_cursor(C, BC_EW_SCROLLCURSOR);
+               WM_cursor_modal(C->window, BC_EW_SCROLLCURSOR);
        else
-               WM_set_cursor(C, BC_NSEW_SCROLLCURSOR);
-#endif // XXX - enable this when cursors are working properly
+               WM_cursor_modal(C->window, BC_NSEW_SCROLLCURSOR);
        
        /* add temp handler */
        WM_event_add_modal_handler(C, &C->window->handlers, op);
@@ -784,7 +780,7 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
                                
                                /* free customdata */
                                view_zoomdrag_exit(C, op);
-                               //WM_set_cursor(C, CURSOR_STD);         // XXX - enable this when cursors are working properly  
+                               WM_cursor_restore(C->window);
                                
                                return OPERATOR_FINISHED;
                        }
index fc6ed8cee54e8f06690069325de71d6b5612e530..da7c38819a2aa8a51e52d2d787055a222700fa9f 100644 (file)
@@ -503,6 +503,7 @@ static void newspace(bContext *C, ScrArea *sa, int type)
 
                sa->spacetype= type;
                sa->butspacetype= type;
+               sa->type= st;
                
                /* check previously stored space */
                for (sl= sa->spacedata.first; sl; sl= sl->next)
index 1c0b8932d94b53df9d3ced7ca7d4508e795b9613..2cf480dc204ca067f2d5807e9f1b3ab2685323bc 100644 (file)
@@ -236,6 +236,39 @@ void removenotused_scredges(bScreen *sc)
        }
 }
 
+int scredge_is_horizontal(ScrEdge *se)
+{
+       return (se->v1->vec.y == se->v2->vec.y);
+}
+
+ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
+{
+       ScrEdge *se;
+       
+       for (se= sc->edgebase.first; se; se= se->next) {
+               if (scredge_is_horizontal(se)) {
+                       short min, max;
+                       min= MIN2(se->v1->vec.x, se->v2->vec.x);
+                       max= MAX2(se->v1->vec.x, se->v2->vec.x);
+                       
+                       if (abs(my-se->v1->vec.y)<=2 && mx>=min && mx<=max)
+                               return se;
+               } 
+               else {
+                       short min, max;
+                       min= MIN2(se->v1->vec.y, se->v2->vec.y);
+                       max= MAX2(se->v1->vec.y, se->v2->vec.y);
+                       
+                       if (abs(mx-se->v1->vec.x)<=2 && my>=min && my<=max)
+                               return se;
+               }
+       }
+       
+       return NULL;
+}
+
+
+
 /* adds no space data */
 static ScrArea *screen_addarea(bScreen *sc, ScrVert *v1, ScrVert *v2, ScrVert *v3, ScrVert *v4, short headertype, short spacetype)
 {
@@ -962,6 +995,8 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
        if(G.f & G_DEBUG) printf("set screen\n");
        win->screen->do_refresh= 0;
 
+       /* cursor types too */
+       ED_screen_set_subwinactive(win);
 }
 
 /* file read, set all screens, ... */
@@ -1017,6 +1052,29 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
        C->window= prevwin;
 }
 
+/* case when on area-edge or in azones */
+static void screen_cursor_set(wmWindow *win, wmEvent *event)
+{
+       ScrArea *sa;
+       
+       for(sa= win->screen->areabase.first; sa; sa= sa->next)
+               if(is_in_area_actionzone(sa, event->x, event->y))
+                       break;
+       
+       if(sa) {
+               WM_cursor_set(win, CURSOR_EDIT);
+       }
+       else {
+               ScrEdge *actedge= screen_find_active_scredge(win->screen, event->x, event->y);
+               
+               if (actedge && scredge_is_horizontal(actedge)) {
+                       WM_cursor_set(win, CURSOR_Y_MOVE);
+               } else {
+                       WM_cursor_set(win, CURSOR_X_MOVE);
+               }
+       } 
+}
+
 
 /* called in wm_event_system.c. sets state var in screen */
 void ED_screen_set_subwinactive(wmWindow *win)
@@ -1024,15 +1082,16 @@ void ED_screen_set_subwinactive(wmWindow *win)
        if(win->screen) {
                wmEvent *event= win->eventstate;
                ScrArea *sa;
+               ARegion *ar;
                int oldswin= win->screen->subwinactive;
                
                for(sa= win->screen->areabase.first; sa; sa= sa->next) {
                        if(event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
                                if(event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
-                                       break;
+                                       if(NULL==is_in_area_actionzone(sa, event->x, event->y))
+                                               break;
                }
                if(sa) {
-                       ARegion *ar;
                        for(ar= sa->regionbase.first; ar; ar= ar->next) {
                                if(BLI_in_rcti(&ar->winrct, event->x, event->y))
                                        win->screen->subwinactive= ar->swinid;
@@ -1043,9 +1102,8 @@ void ED_screen_set_subwinactive(wmWindow *win)
                
                /* check for redraw headers */
                if(oldswin!=win->screen->subwinactive) {
-                       
+
                        for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-                               ARegion *ar;
                                int do_draw= 0;
                                
                                for(ar= sa->regionbase.first; ar; ar= ar->next)
@@ -1059,6 +1117,25 @@ void ED_screen_set_subwinactive(wmWindow *win)
                                }
                        }
                }
+               
+               /* cursors, for time being set always on edges, otherwise aregion doesnt switch */
+               if(win->screen->subwinactive==win->screen->mainwin) {
+                       screen_cursor_set(win, event);
+               }
+               else if(oldswin!=win->screen->subwinactive) {
+                       /* cursor space type switching */
+                       for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+                               for(ar= sa->regionbase.first; ar; ar= ar->next) {
+                                       if(ar->swinid==win->screen->subwinactive) {
+                                               if(sa->type->cursor)
+                                                       sa->type->cursor(win, ar);
+                                               else 
+                                                       WM_cursor_set(win, CURSOR_STD);
+                                       }
+                               }
+                                       
+                       }
+               }
        }
 }
 
index d228748d8736fd588e30c045d7095806c11ff622..855fe7c9b5009285c732525672303536b18d20ee 100644 (file)
@@ -46,6 +46,11 @@ void         removenotused_scrverts(bScreen *sc);
 void           removedouble_scrverts(bScreen *sc);
 void           removedouble_scredges(bScreen *sc);
 void           removenotused_scredges(bScreen *sc);
+int                    scredge_is_horizontal(ScrEdge *se);
+ScrEdge                *screen_find_active_scredge(bScreen *sc, int mx, int my);
+
+AZone *is_in_area_actionzone(ScrArea *sa, int x, int y);
+
 
 #endif /* ED_SCREEN_INTERN_H */
 
index 1f7563b4824173de5588ec6d86149f84223103bb..d16ad075bf3c27b6f3a8ee8c11dc1e9c8376fc73 100644 (file)
@@ -118,7 +118,7 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
 }
 
 
-static AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
+AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
 {
        AZone *az= NULL;
        int i= 0;
@@ -232,78 +232,6 @@ void ED_SCR_OT_actionzone(wmOperatorType *ot)
        ot->poll= ED_operator_areaactive;
 }
 
-/* ****************** cursor near edge operator ********************************* */
-
-static int scredge_is_horizontal(ScrEdge *se)
-{
-       return (se->v1->vec.y == se->v2->vec.y);
-}
-
-static ScrEdge *screen_find_active_scredge(bScreen *sc, int mx, int my)
-{
-       ScrEdge *se;
-       
-       for (se= sc->edgebase.first; se; se= se->next) {
-               if (scredge_is_horizontal(se)) {
-                       short min, max;
-                       min= MIN2(se->v1->vec.x, se->v2->vec.x);
-                       max= MAX2(se->v1->vec.x, se->v2->vec.x);
-                       
-                       if (abs(my-se->v1->vec.y)<=2 && mx>=min && mx<=max)
-                               return se;
-               } 
-               else {
-                       short min, max;
-                       min= MIN2(se->v1->vec.y, se->v2->vec.y);
-                       max= MAX2(se->v1->vec.y, se->v2->vec.y);
-                       
-                       if (abs(mx-se->v1->vec.x)<=2 && my>=min && my<=max)
-                               return se;
-               }
-       }
-       
-       return NULL;
-}
-
-
-/* operator cb */
-static int screen_cursor_test(bContext *C, wmOperator *op, wmEvent *event)
-{
-       if (C->screen->subwinactive==C->screen->mainwin) {
-               ScrEdge *actedge= screen_find_active_scredge(C->screen, event->x, event->y);
-               
-               if (actedge && scredge_is_horizontal(actedge)) {
-                       WM_set_cursor(C, CURSOR_Y_MOVE);
-               } else {
-                       WM_set_cursor(C, CURSOR_X_MOVE);
-               }
-       } 
-       else {
-               ScrArea *sa= NULL;
-               AZone *az= NULL;
-               
-               for(sa= C->screen->areabase.first; sa; sa= sa->next) {
-                       az= is_in_area_actionzone(sa, event->x, event->y);
-                       if(az!=NULL) break;
-               }
-               
-               if(az!=NULL) WM_set_cursor(C, CURSOR_EDIT);
-               else WM_set_cursor(C, CURSOR_STD);
-       }
-       
-       return OPERATOR_PASS_THROUGH;
-}
-
-static void ED_SCR_OT_cursor_type(wmOperatorType *ot)
-{
-    ot->name= "Cursor type";
-    ot->idname= "ED_SCR_OT_cursor_type";
-       
-    ot->invoke= screen_cursor_test;
-    ot->poll= ED_operator_screenactive;
-}
-
-
 
 /* *********** Rip area operator ****************** */
 
@@ -1224,12 +1152,6 @@ static int region_split_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-static int region_split_invoke(bContext *C, wmOperator *op, wmEvent *evt)
-{
-       return region_split_exec(C, op);
-}
-
-
 void ED_SCR_OT_region_split(wmOperatorType *ot)
 {
        PropertyRNA *prop;
@@ -1240,8 +1162,6 @@ void ED_SCR_OT_region_split(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec= region_split_exec;
-       ot->invoke= region_split_invoke;
-       
        ot->poll= ED_operator_areaactive;
        
        prop= RNA_def_property(ot->srna, "dir", PROP_ENUM, PROP_NONE);
@@ -1346,7 +1266,6 @@ void ED_SCR_OT_border_select(wmOperatorType *ot)
 void ED_operatortypes_screen(void)
 {
        /* generic UI stuff */
-       WM_operatortype_append(ED_SCR_OT_cursor_type);
        WM_operatortype_append(ED_SCR_OT_actionzone);
        WM_operatortype_append(ED_SCR_OT_repeat_last);
        
@@ -1367,9 +1286,7 @@ void ED_operatortypes_screen(void)
 void ED_keymap_screen(wmWindowManager *wm)
 {
        ListBase *keymap= WM_keymap_listbase(wm, "Screen", 0, 0);
-       wmKeymapItem *kmi;
        
-       WM_keymap_verify_item(keymap, "ED_SCR_OT_cursor_type", MOUSEMOVE, 0, 0, 0);
        WM_keymap_verify_item(keymap, "ED_SCR_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0);
        
        WM_keymap_verify_item(keymap, "ED_SCR_OT_area_move", LEFTMOUSE, KM_PRESS, 0, 0);
@@ -1378,10 +1295,8 @@ void ED_keymap_screen(wmWindowManager *wm)
        WM_keymap_verify_item(keymap, "ED_SCR_OT_area_rip", RKEY, KM_PRESS, KM_ALT, 0);
 
         /* tests */
-       kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0);
-       RNA_enum_set(kmi->ptr, "dir", 'h');
-       kmi= WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0);
-       RNA_enum_set(kmi->ptr, "dir", 'v');
+       RNA_enum_set(WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, 0, 0)->ptr, "dir", 'h');
+       RNA_enum_set(WM_keymap_add_item(keymap, "ED_SCR_OT_region_split", SKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "dir", 'v');
        WM_keymap_add_item(keymap, "ED_SCR_OT_region_flip", F5KEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "ED_SCR_OT_repeat_last", F4KEY, KM_PRESS, 0, 0);
 }
index 54ec53b2434f3dd7e79b760578ef95b44116929d..5b52e43d0f2927a4f50ed454309d55f2f0ae508c 100644 (file)
@@ -153,12 +153,20 @@ static void text_main_area_draw(const bContext *C, ARegion *ar)
        /* scrollers? */
 }
 
-void text_operatortypes(void)
+static void text_operatortypes(void)
 {
        
 }
 
-void text_keymap(struct wmWindowManager *wm)
+static void text_cursor(wmWindow *win, ARegion *ar)
+{
+       if(ar->regiontype==RGN_TYPE_WINDOW)
+               WM_cursor_set(win, BC_TEXTEDITCURSOR);
+       else
+               WM_cursor_set(win, CURSOR_STD);
+}
+
+static void text_keymap(struct wmWindowManager *wm)
 {
        
 }
@@ -209,6 +217,7 @@ void ED_spacetype_text(void)
        st->init= text_init;
        st->duplicate= text_duplicate;
        st->operatortypes= text_operatortypes;
+       st->cursor= text_cursor;
        st->keymap= text_keymap;
        
        /* regions: main window */
index b278f83706a566291ea240f1192bafe4c2abc612..b0fdcee2c042c3dc0c560025cf42c5ac7bcdb753 100644 (file)
@@ -55,10 +55,11 @@ void                WM_read_autosavefile(struct bContext *C);
 void           WM_write_autosave       (struct bContext *C);
 
                        /* mouse cursors */
-void           WM_init_cursor_data     (void);
-void           WM_set_cursor           (struct bContext *C, int curs);
-void           WM_waitcursor           (struct bContext *C, int val);
-void           WM_timecursor           (struct bContext *C, int nr);
+void           WM_cursor_set           (struct wmWindow *win, int curs);
+void           WM_cursor_modal         (struct wmWindow *win, int curs);
+void           WM_cursor_restore       (struct wmWindow *win);
+void           WM_cursor_wait          (struct wmWindow *win, int val);
+void           WM_timecursor           (struct wmWindow *win, int nr);
 
                        /* keymap and handlers */
 wmKeymapItem *WM_keymap_set_item       (ListBase *lb, char *idname, short type, 
index e4299b8949b306da63c36d64dc02a726f4ebb87c..8b4ddd786e0baf8195e278df9edc8da73030cca7 100644 (file)
@@ -86,15 +86,12 @@ static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useB
 
 /* Cursor Globals */
 static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs */
-static short CurrentCursor=-1, LastCursor=-1;
 
-void WM_set_cursor(bContext *C, int curs)
+void WM_cursor_set(wmWindow *win, int curs)
 {
-       wmWindow *win= C->window;
 
        if (win==NULL) return; /* Can't set custom cursor before Window init */
-       win->cursor= curs;
-       
+
        if (curs==CURSOR_NONE) {
                GHOST_SetCursorVisibility(win->ghostwin, 0);
                return;
@@ -102,18 +99,14 @@ void WM_set_cursor(bContext *C, int curs)
 
        GHOST_SetCursorVisibility(win->ghostwin, 1);
        
-       LastCursor=CurrentCursor;
-       CurrentCursor=curs;
-       
-       /* previous cursor? */
-       if (curs==LASTCURSOR) curs=LastCursor;
+       win->cursor= curs;
        
        /* detect if we use system cursor or Blender cursor */
        if(curs>=BC_GHOST_CURSORS) {
                GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
        }
        else {
-               if ((curs<LASTCURSOR)||(curs>=BC_NUMCURSORS)) return;   
+               if ((curs<SYSCURSOR) || (curs>=BC_NUMCURSORS)) return;  
 
                if (curs==SYSCURSOR) {  /* System default Cursor */
                        GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
@@ -127,18 +120,34 @@ void WM_set_cursor(bContext *C, int curs)
        }
 }
 
-void WM_waitcursor(bContext *C, int val)
+static int LastCursor=-1;      /* global, assumed we only have one */
+
+void WM_cursor_modal(wmWindow *win, int val)
 {
-       if(C->window) {
-               if(val) {
-                       WM_set_cursor(C, CURSOR_WAIT);
-               } else {
-                       WM_set_cursor(C, LASTCURSOR);
-               }
+       if(LastCursor == -1)
+               LastCursor = win->cursor;
+       WM_cursor_set(win, val);
+}
+
+void WM_cursor_restore(wmWindow *win)
+{
+       if(LastCursor != -1)
+               WM_cursor_set(win, LastCursor);
+       LastCursor = -1;
+}
+
+
+void WM_cursor_wait(wmWindow *win, int val)
+{
+       if(val) {
+               WM_cursor_modal(win, CURSOR_WAIT);
+       } else {
+               WM_cursor_restore(win);
        }
 }
 
-void WM_timecursor(bContext *C, int nr)
+/* afer this you can call restore too */
+void WM_timecursor(wmWindow *win, int nr)
 {
        /* 10 8x8 digits */
        static char number_bitmaps[10][8]= {
@@ -157,6 +166,9 @@ void WM_timecursor(bContext *C, int nr)
        unsigned char bitmap[16][2];
        int i, idx;
        
+       if(LastCursor != -1)
+               LastCursor= win->cursor; 
+       
        memset(&bitmap, 0x00, sizeof(bitmap));
        memset(&mask, 0xFF, sizeof(mask));
        
@@ -171,7 +183,7 @@ void WM_timecursor(bContext *C, int nr)
                nr/= 10;
        }
        
-       window_set_custom_cursor(C->window, mask, bitmap, 7, 7);
+       window_set_custom_cursor(win, mask, bitmap, 7, 7);
 }
 
 
@@ -217,7 +229,7 @@ are for */
 #define BEGIN_CURSOR_BLOCK {
 #define END_CURSOR_BLOCK   }
 
-void WM_init_cursor_data(void){
+void wm_init_cursor_data(void){
 
        /********************** NW_ARROW Cursor **************************/
 BEGIN_CURSOR_BLOCK
index a083edf826a5296fbf757d1720e2d6ae9f048fc9..6aa8c9804564fe3d1f7dd4213c869e6e52a319b8 100644 (file)
@@ -648,7 +648,8 @@ void wm_event_do_handlers(bContext *C)
                                int doit= 0;
                                
                                /* XXX to solve, here screen handlers? */
-                               ED_screen_set_subwinactive(win);        /* state variables in screen */
+                               if(!wm_event_always_pass(event))
+                                       ED_screen_set_subwinactive(win);        /* state variables in screen */
                                
                                for(sa= win->screen->areabase.first; sa; sa= sa->next) {
                                        if(wm_event_always_pass(event) || wm_event_prev_inside_i(event, &sa->totrct)) {
index db37f0754a07802f28af54726f651ae47abdb3c2..4d170ceeb46478e105d65ab377fea6ed0d81ddb7 100644 (file)
@@ -74,6 +74,8 @@
 
 #include "WM_api.h"
 #include "WM_types.h"
+
+#include "wm_cursors.h"
 #include "wm_event_system.h"
 #include "wm.h"
 #include "wm_files.h"
@@ -110,6 +112,7 @@ void WM_init(bContext *C)
 {
        
        wm_ghost_init(C);       /* note: it assigns C to ghost! */
+       wm_init_cursor_data();
        wm_operatortype_init();
        
        set_free_windowmanager_cb(wm_close_and_free);   /* library.c */
index 73ff6ccc19ef0a839bff1b6159f7810fa0e8f282..e3f0e846b7abf70cb5dedbb971f090f00e10b3ad 100644 (file)
@@ -32,6 +32,8 @@
 #ifndef WM_CURSORS_H
 #define WM_CURSORS_H
 
+void wm_init_cursor_data(void);
+
 #define BC_GHOST_CURSORS 1000
 
 /* old cursors */
@@ -72,7 +74,6 @@ typedef struct BCursor {
 
 } BCursor;
 
-#define LASTCURSOR -2
 #define SYSCURSOR -1
 enum {
        BC_NW_ARROWCURSOR=0,