diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-08 01:39:24 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-10-08 01:39:24 +0400 |
commit | 1b7e5b9abe7c2431d1572cd39d687a139e7acb9a (patch) | |
tree | 02bb853a2406eaf7d077ee6ae664e4fe4be81d78 /source | |
parent | 0c857a4f1462a909b111ec4533e1c1f5ab54af4f (diff) |
WM: test with context-less add notifier. Notifiers are one
of the main reasons for passing along context, while actually
they don't need much context at all. Might be removed again,
but would like to have this especially for RNA API functions.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index e7f5bb3b291..0054f151803 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -126,7 +126,8 @@ void WM_event_remove_handlers(struct bContext *C, ListBase *handlers); void WM_event_add_mousemove(struct bContext *C); int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event); -void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *data); +void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference); +void WM_main_add_notifier(unsigned int type, void *reference); void wm_event_add (struct wmWindow *win, struct wmEvent *event_to_add); /* XXX only for warning */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 086fdd3665b..4a8aac4525d 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_idprop.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_object.h" #include "BKE_report.h" #include "BKE_scene.h" @@ -118,6 +119,26 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference note->reference= reference; } +void WM_main_add_notifier(unsigned int type, void *reference) +{ + Main *bmain= G.main; + wmWindowManager *wm= bmain->wm.first; + + if(wm) { + wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier"); + + note->wm= wm; + BLI_addtail(¬e->wm->queue, note); + + 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) { wmNotifier *note= wm->queue.first; |