MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tk_CreateMainWindow

Function Tk_CreateMainWindow

micropolis-activity/src/tk/tkwindow.c:558–652  ·  view source on GitHub ↗
(interp, screenName, baseName)

Source from the content-addressed store, hash-verified

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
563Tk_Window
564Tk_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) {

Callers 3

w_tk.cFile · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 8

CreateTopLevelWindowFunction · 0.85
Tcl_InitHashTableFunction · 0.85
Tk_CreateBindingTableFunction · 0.85
Tk_RegisterInterpFunction · 0.85
Tk_GetUidFunction · 0.85
Tcl_SetResultFunction · 0.85
Tk_DestroyWindowFunction · 0.85
Tcl_CreateCommandFunction · 0.50

Tested by

no test coverage detected