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

Function Tk_CreateWindow

micropolis-activity/src/tk/tkwindow.c:677–717  ·  view source on GitHub ↗
(interp, parent, name, screenName)

Source from the content-addressed store, hash-verified

675 * Side effects:
676 * A new window structure is allocated locally. An X
677 * window is not initially created, but will be created
678 * the first time the window is mapped.
679 *
680 *--------------------------------------------------------------
681 */
682
683Tk_Window
684Tk_CreateWindow(interp, parent, name, screenName)
685 Tcl_Interp *interp; /* Interpreter to use for error reporting.
686 * Interp->result is assumed to be
687 * initialized by the caller. */
688 Tk_Window parent; /* Token for parent of new window. */
689 char *name; /* Name for new window. Must be unique
690 * among parent's children. */
691 char *screenName; /* If NULL, new window will be internal on
692 * same screen as its parent. If non-NULL,
693 * gives name of screen on which to create
694 * new window; window will be a top-level
695 * window. */
696{
697 TkWindow *parentPtr = (TkWindow *) parent;
698 TkWindow *winPtr;
699
700 if (screenName == NULL) {
701 winPtr = NewWindow(parentPtr->dispPtr, parentPtr->screenNum);
702 if (NameWindow(interp, winPtr, parentPtr, name) != TCL_OK) {
703 Tk_DestroyWindow((Tk_Window) winPtr);
704 return NULL;
705 } else {
706 return (Tk_Window) winPtr;
707 }
708 } else {
709/*
710 * This is a fix for dvx XOpenDisplay... display name conformalization
711 * bugs...
712 */
713 char dsp[256];
714 int len;
715
716 strcpy(dsp, screenName);
717 len = strlen(dsp);
718 if (len && (dsp[len -1] == '.'))
719 dsp[len -1] = '\0';
720

Callers 1

SendInitFunction · 0.85

Calls 3

NameWindowFunction · 0.85
Tk_DestroyWindowFunction · 0.85
CreateTopLevelWindowFunction · 0.85

Tested by

no test coverage detected