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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user