diff options
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 54 | ||||
-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 | ||||
-rw-r--r-- | source/blender/windowmanager/wm.h | 1 |
7 files changed, 76 insertions, 28 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 75b3d5316fd..a28b3f8b86e 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -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 */ diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 27a730f9dae..3b3eacc3651 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -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 ************** */ 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; } diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index 2dd4acd9be2..2e12f4ed4d5 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -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 */ |