(interp, screenName, baseName)
| 556 | * unique. Tk-related commands are bound into interp. An X |
| 557 | * window is NOT initially created, but will be created the |
| 558 | * first time the window is mapped. |
| 559 | * |
| 560 | *---------------------------------------------------------------------- |
| 561 | */ |
| 562 | |
| 563 | Tk_Window |
| 564 | Tk_CreateMainWindow(interp, screenName, baseName) |
| 565 | Tcl_Interp *interp; /* Interpreter to use for error reporting. */ |
| 566 | char *screenName; /* Name of screen on which to create |
| 567 | * window. Empty or NULL string means |
| 568 | * use DISPLAY environment variable. */ |
| 569 | char *baseName; /* Base name for application; usually of the |
| 570 | * form "prog instance". */ |
| 571 | { |
| 572 | Tk_Window tkwin; |
| 573 | int result, dummy; |
| 574 | Tcl_HashEntry *hPtr; |
| 575 | register TkMainInfo *mainPtr; |
| 576 | register TkWindow *winPtr; |
| 577 | register TkCmd *cmdPtr; |
| 578 | |
| 579 | /* |
| 580 | * Create the basic TkWindow structure. |
| 581 | */ |
| 582 | |
| 583 | tkwin = CreateTopLevelWindow(interp, (Tk_Window) NULL, baseName, |
| 584 | screenName); |
| 585 | if (tkwin == NULL) { |
| 586 | return NULL; |
| 587 | } |
| 588 | |
| 589 | /* |
| 590 | * Create the TkMainInfo structure for this application, and set |
| 591 | * up name-related information for the new window. |
| 592 | */ |
| 593 | |
| 594 | winPtr = (TkWindow *) tkwin; |
| 595 | mainPtr = (TkMainInfo *) ckalloc(sizeof(TkMainInfo)); |
| 596 | mainPtr->winPtr = winPtr; |
| 597 | mainPtr->interp = interp; |
| 598 | Tcl_InitHashTable(&mainPtr->nameTable, TCL_STRING_KEYS); |
| 599 | mainPtr->bindingTable = Tk_CreateBindingTable(interp); |
| 600 | /* XXX: FOCUS */ |
| 601 | /* mainPtr->focusPtr = NULL; */ |
| 602 | mainPtr->optionRootPtr = NULL; |
| 603 | winPtr->mainPtr = mainPtr; |
| 604 | hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy); |
| 605 | Tcl_SetHashValue(hPtr, winPtr); |
| 606 | winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr); |
| 607 | |
| 608 | /* |
| 609 | * Register the interpreter for "send" purposes. If baseName isn't |
| 610 | * already unique, find a unique suffix to add to it to make it |
| 611 | * unique. Change the window's name to contain the suffix. |
| 612 | */ |
| 613 | |
| 614 | result = Tk_RegisterInterp(interp, baseName, tkwin); |
| 615 | if (result == TCL_OK) { |
no test coverage detected