Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-03-06 18:22:28 +0300
committerJulian Eisel <julian@blender.org>2020-03-06 18:27:13 +0300
commitd5572eacc5958db38ac4a4a32eddb3a2cd24bf68 (patch)
tree5252d8f509dae02bf9c137a1710c073d5bbac592 /source/blender/windowmanager/intern/wm_event_system.c
parentb242cc67928a6858a835c088e4d3ea8822c83168 (diff)
Cleanup: Reduce context usage in UI functions
Part of https://developer.blender.org/T74429. There's a chance that this causes some issues becaue in some cases we change from getting the window from context to getting it from somewhere else.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_event_system.c')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index c1bfa904fad..6247cc5d5ea 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -190,11 +190,9 @@ void wm_event_init_from_window(wmWindow *win, wmEvent *event)
/** \name Notifiers & Listeners
* \{ */
-static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, void *reference)
+static bool wm_test_duplicate_notifier(const wmWindowManager *wm, uint type, void *reference)
{
- wmNotifier *note;
-
- for (note = wm->queue.first; note; note = note->next) {
+ for (wmNotifier *note = wm->queue.first; note; note = note->next) {
if ((note->category | note->data | note->subtype | note->action) == type &&
note->reference == reference) {
return 1;
@@ -204,10 +202,8 @@ static bool wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, v
return 0;
}
-/* XXX: in future, which notifiers to send to other windows? */
-void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference)
+void WM_event_add_notifier_ex(wmWindowManager *wm, const wmWindow *win, uint type, void *reference)
{
- wmWindowManager *wm = CTX_wm_manager(C);
wmNotifier *note;
if (wm_test_duplicate_notifier(wm, type, reference)) {
@@ -216,10 +212,9 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
note = MEM_callocN(sizeof(wmNotifier), "notifier");
- note->wm = wm;
- BLI_addtail(&note->wm->queue, note);
+ BLI_addtail(&wm->queue, note);
- note->window = CTX_wm_window(C);
+ note->window = win;
note->category = type & NOTE_CATEGORY;
note->data = type & NOTE_DATA;
@@ -229,6 +224,12 @@ void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference
note->reference = reference;
}
+/* XXX: in future, which notifiers to send to other windows? */
+void WM_event_add_notifier(const bContext *C, uint type, void *reference)
+{
+ WM_event_add_notifier_ex(CTX_wm_manager(C), CTX_wm_window(C), type, reference);
+}
+
void WM_main_add_notifier(unsigned int type, void *reference)
{
Main *bmain = G_MAIN;
@@ -241,8 +242,7 @@ void WM_main_add_notifier(unsigned int type, void *reference)
note = MEM_callocN(sizeof(wmNotifier), "notifier");
- note->wm = wm;
- BLI_addtail(&note->wm->queue, note);
+ BLI_addtail(&wm->queue, note);
note->category = type & NOTE_CATEGORY;
note->data = type & NOTE_DATA;
@@ -3856,11 +3856,9 @@ static void WM_event_remove_handler(ListBase *handlers, wmEventHandler *handler)
}
#endif
-void WM_event_add_mousemove(const bContext *C)
+void WM_event_add_mousemove(wmWindow *win)
{
- wmWindow *window = CTX_wm_window(C);
-
- window->addmousemove = 1;
+ win->addmousemove = 1;
}
/** \} */