| 369 | } |
| 370 | |
| 371 | void |
| 372 | commit_windowchain(void) |
| 373 | { |
| 374 | struct winlink *p; |
| 375 | int n; |
| 376 | int wincap, wincap2; |
| 377 | |
| 378 | if (!chain) |
| 379 | return; |
| 380 | |
| 381 | /* Save wincap* from the real window system - we'll restore it below. */ |
| 382 | wincap = windowprocs.wincap; |
| 383 | wincap2 = windowprocs.wincap2; |
| 384 | |
| 385 | /* add -chainin at head and -chainout at tail */ |
| 386 | p = wl_new(); |
| 387 | p->wincp = win_choices_find("-chainin"); |
| 388 | if (!p->wincp) { |
| 389 | raw_printf("Can't locate processor '-chainin'"); |
| 390 | exit(EXIT_FAILURE); |
| 391 | } |
| 392 | wl_addhead(p); |
| 393 | |
| 394 | p = wl_new(); |
| 395 | p->wincp = win_choices_find("-chainout"); |
| 396 | if (!p->wincp) { |
| 397 | raw_printf("Can't locate processor '-chainout'"); |
| 398 | exit(EXIT_FAILURE); |
| 399 | } |
| 400 | wl_addtail(p); |
| 401 | |
| 402 | /* Now alloc() init() similar to Objective-C. */ |
| 403 | for (n = 1, p = chain; p; n++, p = p->nextlink) { |
| 404 | p->linkdata = (*p->wincp->chain_routine)(WINCHAIN_ALLOC, n, 0, 0, 0); |
| 405 | } |
| 406 | |
| 407 | for (n = 1, p = chain; p; n++, p = p->nextlink) { |
| 408 | if (p->nextlink) { |
| 409 | (void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata, |
| 410 | p->nextlink->wincp->procs, |
| 411 | p->nextlink->linkdata); |
| 412 | } else { |
| 413 | (void) (*p->wincp->chain_routine)(WINCHAIN_INIT, n, p->linkdata, |
| 414 | gl.last_winchoice->procs, 0); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | /* Restore the saved wincap* values. We do it here to give the |
| 419 | * ini_routine()s a chance to change or check them. */ |
| 420 | chain->wincp->procs->wincap = wincap; |
| 421 | chain->wincp->procs->wincap2 = wincap2; |
| 422 | |
| 423 | /* Call the init procs. Do not re-init the terminal real win. */ |
| 424 | p = chain; |
| 425 | while (p->nextlink) { |
| 426 | if (p->wincp->ini_routine) { |
| 427 | (*p->wincp->ini_routine)(WININIT); |
| 428 | } |
no test coverage detected