diff options
author | Ton Roosendaal <ton@blender.org> | 2008-12-27 19:09:56 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2008-12-27 19:09:56 +0300 |
commit | f0f451fc16880315c8c094aaabd0fbf8a06ffede (patch) | |
tree | bfd93ce72af37a8c08898b745e09af08c36e4314 /source/blender/windowmanager/intern | |
parent | 0714d28236e66b258de90bcbb8a1a821ee424a71 (diff) |
2.5
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.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 13 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 18 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 4 |
4 files changed, 31 insertions, 16 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index f37c901b842..ec22bbd365c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -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) diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 437a4494a2e..a8dd6f41e47 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -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); +} diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e29741e4d02..236efb8f8e4 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -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; diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index c12e7921e7f..1f0bf703a59 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -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; } |