2.5
authorTon Roosendaal <ton@blender.org>
Sat, 27 Dec 2008 16:09:56 +0000 (16:09 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 27 Dec 2008 16:09:56 +0000 (16:09 +0000)
Notifier system upgrade, based on Brecht's doc.
Implementation notes:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers#Implementation

In short: let's try to strictly communicate in a notifier what happened.
The listeners then can act themselves. It also means that a frame-changed
notifier doesn't send out redraws, the editors themselves can decide.

19 files changed:
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_action/space_action.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_ipo/space_ipo.c
source/blender/editors/space_time/space_time.c
source/blender/editors/space_time/time_header.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm.h

index b8a4436dedf4789c0afbd0f9a10e6d5c6b6cbf5f..141ed5a9e706aa58ce22ad2f77d4165e9aedc5f4 100644 (file)
@@ -200,7 +200,7 @@ static int ed_marker_add(bContext *C, wmOperator *op)
        sprintf(marker->name, "Frame %d", frame); // XXX - temp code only
        BLI_addtail(markers, marker);
        
-       WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
        //BIF_undo_push("Add Marker");
        
        return OPERATOR_FINISHED;
@@ -336,7 +336,7 @@ static void ed_marker_move_cancel(bContext *C, wmOperator *op)
        ed_marker_move_apply(C, op);
        ed_marker_move_exit(C, op);     
        
-       WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 }
 
 
@@ -379,7 +379,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
                case RIGHTMOUSE:
                        if(WM_modal_tweak_check(evt, mm->event_type)) {
                                ed_marker_move_exit(C, op);
-                               WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+                               WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
                                return OPERATOR_FINISHED;
                        }
                        
@@ -456,7 +456,7 @@ XXX                                 else if (mm->slink->spacetype == SPACE_ACTION) {
                                        }
                                }
                                
-                               WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+                               WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
                                // headerprint(str); XXX
                        }
        }
@@ -623,7 +623,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend)
        else
                select_timeline_marker_frame(markers, cfra, 0);
        
-       WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 
        return OPERATOR_PASS_THROUGH;
 }
@@ -716,7 +716,7 @@ static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
                }
        }
        
-       WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 
        return 1;
 }
@@ -769,7 +769,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
                        marker->flag &= ~SELECT;
        }
        
-       WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
 
        return OPERATOR_FINISHED;
 }
@@ -816,7 +816,7 @@ static int ed_marker_delete_exec(bContext *C, wmOperator *op)
        }
        
        if(changed) {
-               WM_event_add_notifier(C, WM_NOTE_MARKERS_CHANGED, 0, NULL);
+               WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL);
        }
        return OPERATOR_FINISHED;
 }
index 539ba33dc556775c44df7f0e39e4f59ad3acf777..b47bf3c4611cc7687ec7921d76bad40ac939cf77 100644 (file)
@@ -101,8 +101,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
        if (cfra != scene->r.cfra)
                scene->r.cfra= cfra;
        
-       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
-       /* XXX: add WM_NOTE_TIME_CHANGED? */
+       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
 }
 
 /* Clear any temp flags */
index 0009f301b63325b0e869a0f07f861fc6acb5ddd5..063255bed86eef1934da8f75b120c695ca88fd09 100644 (file)
@@ -392,7 +392,7 @@ void ui_tooltip_free(bContext *C, ARegion *ar)
 {
        ui_remove_temporary_region(C, CTX_wm_screen(C), ar);
 
-       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+       WM_event_add_notifier(C, NC_WINDOW, NULL);      // XXX provide rect for window
 }
 
 /************************* Creating Menu Blocks **********************/
@@ -710,7 +710,7 @@ void ui_menu_block_free(bContext *C, uiMenuBlockHandle *handle)
        ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
        MEM_freeN(handle);
 
-       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+       WM_event_add_notifier(C, NC_WINDOW, NULL);      // XXX provide rect for window
 }
 
 /***************************** Menu Button ***************************/
index 3c5c72cda5f7eade1085011d3faab84dd5ba7c50..b63777cccf0ef2eea2f685c9a9c253cd5c710ec2 100644 (file)
@@ -107,13 +107,12 @@ void ED_region_pixelspace(ARegion *ar)
 void ED_region_do_listen(ARegion *ar, wmNotifier *note)
 {
        /* generic notes first */
-       switch(note->type) {
-               case WM_NOTE_WINDOW_REDRAW:
-               case WM_NOTE_SCREEN_CHANGED:
+       switch(note->category) {
+               case NC_WINDOW:
                        ED_region_tag_redraw(ar);
                        break;
-               case WM_NOTE_GESTURE_REDRAW:
-                       if(note->swinid==ar->swinid)
+               case NC_SCREEN:
+                       if(note->action==NA_EDITED)
                                ED_region_tag_redraw(ar);
                        break;
                default:
index 6d16e522a11552aa924e28eb841c26244b610a8a..50a6381e1f429777622531a916f7bc937d283a77 100644 (file)
@@ -912,15 +912,13 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
 {
        
        /* generic notes */
-       switch(note->type) {
-               case WM_NOTE_WINDOW_REDRAW:
+       switch(note->category) {
+               case NC_WINDOW:
                        win->screen->do_draw= 1;
                        break;
-               case WM_NOTE_SCREEN_CHANGED:
-                       win->screen->do_draw= win->screen->do_refresh= 1;
-                       break;
-               case WM_NOTE_GESTURE_REDRAW:
-                       win->screen->do_gesture= 1;     /* XXX gestures are stored in window, draw per region... a bit weak? wait for proper composite? (ton) */
+               case NC_SCREEN:
+                       if(note->action==NA_EDITED)
+                               win->screen->do_draw= win->screen->do_refresh= 1;
                        break;
        }
 }
@@ -1207,7 +1205,7 @@ void ed_screen_set(bContext *C, bScreen *sc)
                CTX_wm_window(C)->screen= sc;
                
                ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C));
-               WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+               WM_event_add_notifier(C, NC_WINDOW, NULL);
        }
 }
 
index 5f38081f7fc9ecb9681f0bb2c13959298b89cfc3..3197d23988c7fa6a93f6da55f4d475719f87b886 100644 (file)
@@ -330,7 +330,7 @@ static int screen_area_rip_op(bContext *C, wmOperator *op)
        area_copy_data((ScrArea *)newsc->areabase.first, sa, 0);
        
        /* screen, areas init */
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -473,7 +473,7 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
                }
        }
 
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
 }
 
 static void area_move_apply(bContext *C, wmOperator *op)
@@ -727,7 +727,7 @@ static int area_split_apply(bContext *C, wmOperator *op)
                if(dir=='h') sd->origval= sd->nedge->v1->vec.y;
                else sd->origval= sd->nedge->v1->vec.x;
 
-               WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+               WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
                
                return 1;
        }               
@@ -742,7 +742,7 @@ static void area_split_exit(bContext *C, wmOperator *op)
                op->customdata = NULL;
        }
        
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
 
        /* this makes sure aligned edges will result in aligned grabbing */
        removedouble_scrverts(CTX_wm_screen(C));
@@ -853,7 +853,7 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
                        fac= (dir == 'v') ? event->x-sd->origmin : event->y-sd->origmin;
                        RNA_float_set(op->ptr, "fac", fac / (float)sd->origsize);
                        
-                       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
                        break;
                        
                case LEFTMOUSE:
@@ -910,8 +910,7 @@ static int frame_offset_exec(bContext *C, wmOperator *op)
        delta = RNA_int_get(op->ptr, "delta");
 
        CTX_data_scene(C)->r.cfra += delta;
-       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
-       /* XXX: add WM_NOTE_TIME_CHANGED? */
+       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
 
        return OPERATOR_FINISHED;
 }
@@ -1156,7 +1155,7 @@ static int area_join_cancel(bContext *C, wmOperator *op)
                jd->sa2->flag &= ~AREA_FLAG_DRAWJOINTO;
        }
 
-       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+       WM_event_add_notifier(C, NC_WINDOW, NULL);
        
        area_join_exit(C, op);
 
@@ -1204,7 +1203,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                                jd->sa2 = NULL;
                                                        }
                                                }
-                                               WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                                               WM_event_add_notifier(C, NC_WINDOW, NULL);
                                        } 
                                        else {
                                                /* we are back in the area previously selected for keeping 
@@ -1229,7 +1228,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                                jd->sa2->flag |= AREA_FLAG_DRAWJOINTO;
                                                        }
                                                }
-                                               WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                                               WM_event_add_notifier(C, NC_WINDOW, NULL);
                                        }
                                }
                        }
@@ -1237,7 +1236,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
                case LEFTMOUSE:
                        if(event->val==0) {
                                area_join_apply(C, op);
-                               WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+                               WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
                                area_join_exit(C, op);
                                return OPERATOR_FINISHED;
                        }
@@ -1324,7 +1323,7 @@ static int region_split_exec(bContext *C, wmOperator *op)
        else
                ar->alignment= RGN_ALIGN_VSPLIT;
        
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1363,7 +1362,7 @@ static int region_flip_exec(bContext *C, wmOperator *op)
        else if(ar->alignment==RGN_ALIGN_RIGHT)
                ar->alignment= RGN_ALIGN_LEFT;
        
-       WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+       WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
        
        return OPERATOR_FINISHED;
 }
@@ -1401,7 +1400,7 @@ static int screen_animation_play(bContext *C, wmOperator *op, wmEvent *event)
                                scene->r.cfra= scene->r.sfra;
                }
 
-               WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+               WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C));
                
                return OPERATOR_FINISHED;
        }
index 3a16454fb4622e7805de3762a6355d86ddbea748..05cff8c690dc8ba924a5eb067b21dc8358cecc40 100644 (file)
@@ -308,7 +308,7 @@ static void do_action_buttons(bContext *C, void *arg, int event)
 {
        switch(event) {
                case B_REDR:
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       ED_region_tag_redraw(CTX_wm_region(C));
                        break;
        }
 }
index b9e7c76cbf438aa6e304d324f90ec213211ac004..f772896a5a31aa71e7642cb47087a3c8f2267ff1 100644 (file)
@@ -289,9 +289,14 @@ static void action_header_area_draw(const bContext *C, ARegion *ar)
 static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
-       switch(wmn->type) {
-               case WM_NOTE_MARKERS_CHANGED:
-                       ED_region_tag_redraw(ar);
+       switch(wmn->category) {
+               case NC_SCENE:
+                       switch(wmn->data) {
+                               case ND_FRAME:
+                               case ND_MARKERS:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                       }
                        break;
        }
 }
index 552093b47a5da3dd7bc56c1d2103366c839e0c8e..5090a81aaa7ecbea2f65bcb38bc8b7db6d04d9c3 100644 (file)
@@ -99,7 +99,7 @@ static void do_buttons_buttons(bContext *C, void *arg, int event)
 {
        switch(event) {
                case B_NEWFRAME:
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, NULL);
                        break;
                case B_CONTEXT_SWITCH:
                        ED_area_tag_redraw(CTX_wm_area(C));
index 00e446c65a9d3d87c6de8b90e9e5761cf59ee152..8a301378fd70808b99ab883ac722ef4ae21f8b00 100644 (file)
@@ -275,10 +275,15 @@ static void ipo_header_area_draw(const bContext *C, ARegion *ar)
 static void ipo_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
-       switch(wmn->type) {
+       switch(wmn->category) {
                
-               case WM_NOTE_MARKERS_CHANGED:
-                       ED_region_tag_redraw(ar);
+               case NC_SCENE:
+                       switch(wmn->data) {
+                               case ND_FRAME:
+                               case ND_MARKERS:
+                                       ED_region_tag_redraw(ar);
+                                       break;
+                               }
                        break;
        }
 }
index 81c5334ef31a0dc0bc647216cb814aeaa9f0e4d8..11ab7b19a6b67452372d68372202341f40b755c2 100644 (file)
@@ -164,9 +164,10 @@ static void time_main_area_draw(const bContext *C, ARegion *ar)
 static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
        /* context changes */
-       switch(wmn->type) {
+       switch(wmn->category) {
                
-               case WM_NOTE_MARKERS_CHANGED:
+               case NC_SCENE:
+                       /* any scene change for now */
                        ED_region_tag_redraw(ar);
                        break;
        }
index b760f1f969bcfc61dc83443bc69ae64fbe22ffed..94c3e03ff8cc649a484785b5a39ce392356077fd 100644 (file)
@@ -275,7 +275,7 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
                        }                               
                        else
                                scene->r.sfra = scene->r.cfra;
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
                        break;
                case 2: /* Set as End */
                        if (scene->r.psfra) {
@@ -285,7 +285,7 @@ static void do_time_framemenu(bContext *C, void *arg, int event)
                        }                               
                        else
                                scene->r.efra = scene->r.cfra;
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
                        break;
                case 3: /* Rename Marker */
                        //rename_marker();
@@ -362,8 +362,10 @@ void do_time_buttons(bContext *C, void *arg, int event)
        
        switch(event) {
                case B_REDRAWALL:
+                       WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+                       break;
                case B_NEWFRAME:
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
                        break;
                case B_TL_REW:
                        scene->r.cfra= PSFRA;
@@ -374,7 +376,6 @@ void do_time_buttons(bContext *C, void *arg, int event)
                        break;
                case B_TL_STOP:
                        ED_screen_animation_timer(C, 0);
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
                        break;
                case B_TL_FF:
                        /* end frame */
@@ -402,7 +403,7 @@ void do_time_buttons(bContext *C, void *arg, int event)
                                scene->r.pefra= 0;
                        }
                        //BIF_undo_push("Set anim-preview range");
-                       WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                       WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
                        break;
                        
                case B_TL_INSERTKEY:
index 75b3d5316fdb71a1f9de8e6c8bd541f63bed9ed7..a28b3f8b86ec06ed4d78806638fb85e06ceda544 100644 (file)
@@ -95,7 +95,7 @@ void          WM_event_remove_handlers(struct bContext *C, ListBase *handlers);
 
 void           WM_event_add_mousemove(struct bContext *C);
 
-void           WM_event_add_notifier(struct bContext *C, int type, int value, void *data);
+void           WM_event_add_notifier(struct bContext *C, unsigned int type, void *data);
 
 void           wm_event_add            (wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */
 
index 27a730f9daee6618a22a6d7b46e8955476bcea06..3b3eacc365107cab08338b14bec532828903200b 100644 (file)
@@ -117,21 +117,53 @@ typedef struct wmNotifier {
        struct wmWindow *window;
        
        int swinid;
-       int type;
-       int value;
-       void *data;
+       unsigned int category, data, subtype, action;
+       
+       void *reference;
        
 } wmNotifier;
 
 
-enum {
-       WM_NOTE_WINDOW_REDRAW,
-       WM_NOTE_SCREEN_CHANGED,
-       WM_NOTE_GESTURE_REDRAW,
-       WM_NOTE_MARKERS_CHANGED,
-       WM_NOTE_OBJECT_CHANGED,
-       WM_NOTE_LAST
-};
+/* 4 levels 
+
+0xFF000000; category
+0x00FF0000; data
+0x0000FF00; data subtype (unused?)
+0x000000FF; action
+*/
+
+/* category */
+#define NOTE_CATEGORY          0xFF000000
+#define        NC_WINDOW                       (1<<24)
+#define        NC_SCREEN                       (2<<24)
+#define        NC_SCENE                        (3<<24)
+#define        NC_OBJECT                       (4<<24)
+#define        NC_MATERIAL                     (5<<24)
+#define        NC_TEXTURE                      (6<<24)
+
+/* data type, 256 entries is enough, it can overlap */
+#define NOTE_DATA                      0x00FF0000
+
+       /* Scene, node users level */
+#define        ND_MARKERS                      (2<<16)
+#define        ND_FRAME                        (3<<16)
+#define        ND_RENDER_OPTIONS       (4<<16)
+#define        ND_NODES                        (5<<16)
+#define        ND_SEQUENCER            (6<<16)
+       /* Object */
+#define        ND_TRANSFORM            (16<<16)
+#define ND_SHADING                     (17<<16)
+
+/* subtype, 256 entries too */
+#define NOTE_SUBTYPE           0x0000FF00
+
+/* action classification */
+#define NOTE_ACTION                    (0x000000FF)
+#define NA_EDITED                      1
+#define NA_EVALUATED           2
+#define NA_ADDED                       3
+#define NA_REMOVED                     4
+
 
 /* ************** Gesture Manager data ************** */
 
index f37c901b842c1c50a40bf7588d11e213961a8c99..ec22bbd365c84f93085f94dc24e79cde287e9c5b 100644 (file)
@@ -96,7 +96,7 @@ void wm_event_free_all(wmWindow *win)
 /* ********************* notifiers, listeners *************** */
 
 /* XXX: in future, which notifiers to send to other windows? */
-void WM_event_add_notifier(bContext *C, int type, int value, void *data)
+void WM_event_add_notifier(bContext *C, unsigned int type, void *reference)
 {
        wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier");
        
@@ -105,9 +105,13 @@ void WM_event_add_notifier(bContext *C, int type, int value, void *data)
        note->window= CTX_wm_window(C);
        if(CTX_wm_region(C))
                note->swinid= CTX_wm_region(C)->swinid;
-       note->type= type;
-       note->value= value;
-       note->data= data;
+       
+       note->category= type & NOTE_CATEGORY;
+       note->data= type & NOTE_DATA;
+       note->subtype= type & NOTE_SUBTYPE;
+       note->action= type & NOTE_ACTION;
+       
+       note->reference= reference;
 }
 
 static wmNotifier *wm_notifier_next(wmWindowManager *wm)
index 437a4494a2ecbdca7b6ae527a68e28be0d136634..a8dd6f41e4777a54f55eb5bf72333a6152457320 100644 (file)
@@ -46,6 +46,8 @@
 #include "wm_event_system.h"
 #include "wm_subwindow.h"
 
+#include "ED_screen.h"
+
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
@@ -227,4 +229,13 @@ void wm_gesture_draw(wmWindow *win)
        }
 }
 
-
+void wm_gesture_tag_redraw(bContext *C)
+{
+       bScreen *screen= CTX_wm_screen(C);
+       ARegion *ar= CTX_wm_region(C);
+       
+       if(screen)
+               screen->do_gesture= 1;
+       if(ar)
+               ED_region_tag_redraw(ar);
+}
index e29741e4d02229c71be035e8f1321dbc189b737d..236efb8f8e4e135f640792204766021dbdc1f1c5 100644 (file)
@@ -387,7 +387,7 @@ int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        /* add modal handler */
        WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
        
-       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+       wm_gesture_tag_redraw(C);
 
        return OPERATOR_RUNNING_MODAL;
 }
@@ -412,7 +412,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
                                rect->ymax= event->y - sy;
                        }
                        
-                       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                       wm_gesture_tag_redraw(C);
 
                        break;
                        
@@ -422,7 +422,7 @@ int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
                        if(event->val==1) {
                                if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
                                        gesture->mode= 1;
-                                       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                                       wm_gesture_tag_redraw(C);
                                }
                        }
                        else {
@@ -448,7 +448,7 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
        /* add modal handler */
        WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
        
-       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+       wm_gesture_tag_redraw(C);
        
        return OPERATOR_RUNNING_MODAL;
 }
@@ -493,7 +493,7 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
                        rect->xmin= event->x - sx;
                        rect->ymin= event->y - sy;
                        
-                       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                       wm_gesture_tag_redraw(C);
                        
                        if(gesture->mode)
                                gesture_circle_apply(C, op, event->type);
@@ -501,12 +501,12 @@ int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
                        break;
                case WHEELUPMOUSE:
                        rect->xmax += 2 + rect->xmax/10;
-                       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                       wm_gesture_tag_redraw(C);
                        break;
                case WHEELDOWNMOUSE:
                        rect->xmax -= 2 + rect->xmax/10;
                        if(rect->xmax < 1) rect->xmax= 1;
-                       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                       wm_gesture_tag_redraw(C);
                        break;
                case LEFTMOUSE:
                case MIDDLEMOUSE:
@@ -554,7 +554,7 @@ static int tweak_gesture_invoke(bContext *C, wmOperator *op, wmEvent *event)
        /* add modal handler */
        WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
        
-       WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+       wm_gesture_tag_redraw(C);
        
        return OPERATOR_RUNNING_MODAL;
 }
@@ -603,7 +603,7 @@ static int tweak_gesture_modal(bContext *C, wmOperator *op, wmEvent *event)
                                return OPERATOR_FINISHED;
                        }
                        else
-                               WM_event_add_notifier(C, WM_NOTE_GESTURE_REDRAW, 0, NULL);
+                               wm_gesture_tag_redraw(C);
                        
                        break;
                        
index c12e7921e7f1037ebd6e778283b781ab532b2d31..1f0bf703a594b55f3290136815889142b78e5bec 100644 (file)
@@ -441,7 +441,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                if(G.f & G_DEBUG) printf("ghost redraw\n");
                                
                                wm_window_make_drawable(C, win);
-                               WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL);
+                               WM_event_add_notifier(C, NC_WINDOW, NULL);
 
                                break;
                        }
@@ -486,7 +486,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
                                }
                                
                                wm_window_make_drawable(C, win);
-                               WM_event_add_notifier(C, WM_NOTE_SCREEN_CHANGED, 0, NULL);
+                               WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
                                
                                break;
                        }
index 2dd4acd9be2347cfe5d3500265049c5fa77c0e62..2e12f4ed4d579478cb3842e8af5f91fdff17289d 100644 (file)
@@ -49,6 +49,7 @@ void wm_window_keymap(wmWindowManager *wm);
 /* wm_gesture.c */
 void wm_gesture_draw(struct wmWindow *win);
 int wm_gesture_evaluate(bContext *C, wmGesture *gesture);
+void wm_gesture_tag_redraw(bContext *C);
 
 #endif /* WM_H */