[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23698] trunk/blender/source/blender/ windowmanager: WM: test with context-less add notifier.
Brecht Van Lommel
brecht at blender.org
Wed Oct 7 23:39:24 CEST 2009
Revision: 23698
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23698
Author: blendix
Date: 2009-10-07 23:39:24 +0200 (Wed, 07 Oct 2009)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
Modified: trunk/blender/source/blender/windowmanager/WM_api.h
===================================================================
--- trunk/blender/source/blender/windowmanager/WM_api.h 2009-10-07 21:19:58 UTC (rev 23697)
+++ trunk/blender/source/blender/windowmanager/WM_api.h 2009-10-07 21:39:24 UTC (rev 23698)
@@ -126,7 +126,8 @@
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 */
Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2009-10-07 21:19:58 UTC (rev 23697)
+++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2009-10-07 21:39:24 UTC (rev 23698)
@@ -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 @@
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;
More information about the Bf-blender-cvs
mailing list