commit 86c66b02a69560b032d978b11c60f5524ba417e4 from: Stefan Sperling date: Thu Oct 18 09:11:12 2018 UTC allow only one parent view per type in tog commit - c0d30c230201ac93afae8ccdccb2d4a167aa5e54 commit + 86c66b02a69560b032d978b11c60f5524ba417e4 blob - 207301ac4b20e2a7e056c0d7c4088400c12ec792 blob + a9cdcb7e8b48cb53470643edfee2b4177b528ac2 --- tog/tog.c +++ tog/tog.c @@ -602,6 +602,19 @@ view_loop(struct tog_view *view) } } if (new_view) { + struct tog_view *v, *t; + /* Only allow one parent view per type. */ + TAILQ_FOREACH_SAFE(v, &views, entry, t) { + if (v->type != new_view->type) + continue; + TAILQ_REMOVE(&views, v, entry); + err = view_close(v); + if (err) + goto done; + if (v == view) + view = new_view; + break; + } TAILQ_INSERT_TAIL(&views, new_view, entry); if (focus_view == NULL) focus_view = new_view;