diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 03:37:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-27 03:37:08 +0400 |
commit | 8ef934c73f3baeaa582efb8de906b27a3854979c (patch) | |
tree | 95dcb068fc96b3323e6ffe425ee6a7481b23eab4 /source/blender/windowmanager | |
parent | cdd57d499434061de35af23790c993220922b206 (diff) |
ghash/bli-listbase edits, rename BLI_ghash_pop -> BLI_ghash_popkey (since it takes a key as an arg and isnt popping any element from the hash as you might expect).
add BLI_pophead/tail, since getting the first element from a list and removing it is a common task.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 12 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 17 |
2 files changed, 7 insertions, 22 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index a109c2cbd7b..74c066d1d86 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -156,8 +156,7 @@ void WM_operator_stack_clear(wmWindowManager *wm) { wmOperator *op; - while ((op = wm->operators.first)) { - BLI_remlink(&wm->operators, op); + while ((op = BLI_pophead(&wm->operators))) { WM_operator_free(op); } @@ -414,20 +413,17 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm) if (wm->autosavetimer) wm_autosave_timer_ended(wm); - while ((win = wm->windows.first)) { - BLI_remlink(&wm->windows, win); + while ((win = BLI_pophead(&wm->windows))) { win->screen = NULL; /* prevent draw clear to use screen */ wm_draw_window_clear(win); wm_window_free(C, wm, win); } - while ((op = wm->operators.first)) { - BLI_remlink(&wm->operators, op); + while ((op = BLI_pophead(&wm->operators))) { WM_operator_free(op); } - while ((keyconf = wm->keyconfigs.first)) { - BLI_remlink(&wm->keyconfigs, keyconf); + while ((keyconf = BLI_pophead(&wm->keyconfigs))) { WM_keyconfig_free(keyconf); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 08432d62720..a74e7486e8b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -127,8 +127,7 @@ void wm_event_free_all(wmWindow *win) { wmEvent *event; - while ((event = win->queue.first)) { - BLI_remlink(&win->queue, event); + while ((event = BLI_pophead(&win->queue))) { wm_event_free(event); } } @@ -233,14 +232,6 @@ static void wm_notifier_clear(wmNotifier *note) memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link)); } -static wmNotifier *wm_notifier_next(wmWindowManager *wm) -{ - wmNotifier *note = wm->queue.first; - - if (note) BLI_remlink(&wm->queue, note); - return note; -} - /* called in mainloop */ void wm_event_do_notifiers(bContext *C) { @@ -316,7 +307,7 @@ void wm_event_do_notifiers(bContext *C) } /* the notifiers are sent without context, to keep it clean */ - while ( (note = wm_notifier_next(wm)) ) { + while ((note = BLI_pophead(&wm->queue))) { for (win = wm->windows.first; win; win = win->next) { /* filter out notifiers */ @@ -1331,9 +1322,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers) wmWindowManager *wm = CTX_wm_manager(C); /* C is zero on freeing database, modal handlers then already were freed */ - while ((handler = handlers->first)) { - BLI_remlink(handlers, handler); - + while ((handler = BLI_pophead(handlers))) { if (handler->op) { if (handler->op->type->cancel) { ScrArea *area = CTX_wm_area(C); |