diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-25 02:41:33 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-06-25 02:41:33 +0400 |
commit | 02fbfa5c70732e691606546ecce60fdfe3f80d9f (patch) | |
tree | 9c5e5be02ae4b87b52642d77f264ce1f76d48e41 /source/blender/windowmanager | |
parent | 8390aa5181d3dd9c8458fa68c2add910c1cd12e9 (diff) |
Fix unnecessary 3D viewport redraws in various cases, in particular when editing
node materials.
Area and region listener callbacks now get the screen and area pointers passed, so
they can do more fine grained checks to see if redraw is really needed, for example
depending on the 3D view drawtype.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 44 |
2 files changed, 27 insertions, 18 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index cd3899897a1..f1932c8aa97 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -302,6 +302,7 @@ typedef struct wmNotifier { #define ND_SHADING (30<<16) #define ND_SHADING_DRAW (31<<16) #define ND_SHADING_LINKS (32<<16) +#define ND_SHADING_PREVIEW (33<<16) /* NC_LAMP Lamp */ #define ND_LIGHTING (40<<16) diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ac714b09bb0..0bef59cfc55 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -148,9 +148,15 @@ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, vo void WM_event_add_notifier(const bContext *C, unsigned int type, void *reference) { ARegion *ar; - wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier"); + wmWindowManager *wm = CTX_wm_manager(C); + wmNotifier *note; + + if (wm_test_duplicate_notifier(wm, type, reference)) + return; + + note = MEM_callocN(sizeof(wmNotifier), "notifier"); - note->wm = CTX_wm_manager(C); + note->wm = wm; BLI_addtail(¬e->wm->queue, note); note->window = CTX_wm_window(C); @@ -171,20 +177,22 @@ void WM_main_add_notifier(unsigned int type, void *reference) { Main *bmain = G.main; wmWindowManager *wm = bmain->wm.first; + wmNotifier *note; - if (wm && !wm_test_duplicate_notifier(wm, type, reference)) { - 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; - } + if (!wm || wm_test_duplicate_notifier(wm, type, reference)) + return; + + 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; } /** @@ -312,13 +320,13 @@ void wm_event_do_notifiers(bContext *C) ED_screen_do_listen(C, note); for (ar = win->screen->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(ar, note); + ED_region_do_listen(win->screen, NULL, ar, note); } for (sa = win->screen->areabase.first; sa; sa = sa->next) { - ED_area_do_listen(sa, note); + ED_area_do_listen(win->screen, sa, note); for (ar = sa->regionbase.first; ar; ar = ar->next) { - ED_region_do_listen(ar, note); + ED_region_do_listen(win->screen, sa, ar, note); } } } |