/*
* tkWindow.c --
*
* This file provides basic window-manipulation procedures,
* which are equivalent to procedures in Xlib (and even
* invoke them) but also maintain the local Tk_Window
* structure.
*
* Copyright (c) 1989-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: @(#) tkWindow.c 1.216 97/01/20 11:43:41
*/
#include "tkInt.h"
/*
* Count of number of main windows currently open in this process.
*/
static int numMainWindows;
/*
* First in list of all main windows managed by this process.
*/
/*
* List of all displays currently in use.
*/
/*
* Have statics in this module been initialized?
*/
static int initialized = 0;
/*
* The variables below hold several uid's that are used in many places
* in the toolkit.
*/
/*
* Default values for "changes" and "atts" fields of TkWindows. Note
* that Tk always requests all events for all windows, except StructureNotify
* events on internal windows: these events are generated internally.
*/
};
#define ALL_EVENTS_MASK \
None, /* background_pixmap */
0, /* background_pixel */
CopyFromParent, /* border_pixmap */
0, /* border_pixel */
NorthWestGravity, /* bit_gravity */
NorthWestGravity, /* win_gravity */
NotUseful, /* backing_store */
(unsigned) ~0, /* backing_planes */
0, /* backing_pixel */
False, /* save_under */
ALL_EVENTS_MASK, /* event_mask */
0, /* do_not_propagate_mask */
False, /* override_redirect */
CopyFromParent, /* colormap */
None /* cursor */
};
/*
* The following structure defines all of the commands supported by
* Tk, and the C procedures that execute them.
*/
typedef struct {
/* Command procedure. */
} TkCmd;
/*
* Commands that are part of the intrinsics:
*/
{"bell", Tk_BellCmd},
{"bind", Tk_BindCmd},
{"bindtags", Tk_BindtagsCmd},
{"clipboard", Tk_ClipboardCmd},
{"destroy", Tk_DestroyCmd},
{"event", Tk_EventCmd},
{"focus", Tk_FocusCmd},
{"grab", Tk_GrabCmd},
{"grid", Tk_GridCmd},
{"image", Tk_ImageCmd},
{"lower", Tk_LowerCmd},
{"option", Tk_OptionCmd},
{"pack", Tk_PackCmd},
{"place", Tk_PlaceCmd},
{"raise", Tk_RaiseCmd},
{"selection", Tk_SelectionCmd},
{"tk", Tk_TkCmd},
{"tkwait", Tk_TkwaitCmd},
{"tk_chooseColor", Tk_ChooseColorCmd},
{"tk_getOpenFile", Tk_GetOpenFileCmd},
{"tk_getSaveFile", Tk_GetSaveFileCmd},
{"tk_messageBox", Tk_MessageBoxCmd},
{"update", Tk_UpdateCmd},
{"winfo", Tk_WinfoCmd},
{"wm", Tk_WmCmd},
/*
* Widget class commands.
*/
{"button", Tk_ButtonCmd},
{"canvas", Tk_CanvasCmd},
{"checkbutton", Tk_CheckbuttonCmd},
{"entry", Tk_EntryCmd},
{"frame", Tk_FrameCmd},
{"label", Tk_LabelCmd},
{"listbox", Tk_ListboxCmd},
{"menu", Tk_MenuCmd},
{"menubutton", Tk_MenubuttonCmd},
{"message", Tk_MessageCmd},
{"radiobutton", Tk_RadiobuttonCmd},
{"scale", Tk_ScaleCmd},
{"scrollbar", Tk_ScrollbarCmd},
{"text", Tk_TextCmd},
{"toplevel", Tk_ToplevelCmd},
/*
* Native widget class commands.
*/
#ifdef MAC_TCL
{"macscrollbar", Tk_MacScrollbarCmd},
{"unsupported1", TkUnsupported1Cmd},
#endif
};
/*
* The variables and table below are used to parse arguments from
* the "argv" variable in Tk_Init.
*/
static int synchronize;
static char *name;
static char *display;
static char *geometry;
static char *colormap;
static char *visual;
static int rest = 0;
"Colormap for main window"},
"Display to use"},
"Initial geometry for window"},
"Name to use for application"},
"Use synchronous mode for display server"},
"Visual for main window"},
"Pass all remaining arguments through to script"},
(char *) NULL}
};
/*
* Forward declarations to procedures defined later in this file:
*/
static void DeleteWindowsExitProc _ANSI_ARGS_((
char *screenName, int *screenPtr));
char *name));
/*
*----------------------------------------------------------------------
*
* CreateTopLevelWindow --
*
* Make a new window that will be at top-level (its parent will
* be the root window of a screen).
*
* Results:
* The return value is a token for the new window, or NULL if
* an error prevented the new window from being created. If
* NULL is returned, an error message will be left in
* interp->result.
*
* Side effects:
* A new window structure is allocated locally. An X
* window is NOT initially created, but will be created
* the first time the window is mapped.
*
*----------------------------------------------------------------------
*/
static Tk_Window
* (used for naming, options, etc.). May
* be NULL. */
char *name; /* Name for new window; if parent is
* non-NULL, must be unique among parent's
* children. */
char *screenName; /* Name of screen on which to create
* window. NULL means use DISPLAY environment
* variable to determine. Empty string means
* use parent's screen, or DISPLAY if no
* parent. */
{
int screenId;
if (!initialized) {
initialized = 1;
/*
* Create built-in image types.
*/
/*
* Create built-in photo image formats.
*/
/*
* Create exit handler to delete all windows when the application
* exits.
*/
}
} else {
}
}
/*
* Force the window to use a the border pixel instead of border
* pixmap. This is needed for the case where the window doesn't
* use the default visual. In this case, the default border is
* a pixmap inherited from the root window, which won't work because
* it will have the wrong visual.
*/
/*
* Internal windows don't normally ask for StructureNotify events,
* since we can generate them internally. However, for top-level
* windows we need to ask for the events because the window could
* be manipulated externally.
*/
/*
* (Need to set the TK_TOP_LEVEL flag immediately here; otherwise
* Tk_DestroyWindow will core dump if it is called before the flag
* has been set.)
*/
}
}
}
/*
*----------------------------------------------------------------------
*
* GetScreen --
*
* Given a string name for a display-plus-screen, find the
* TkDisplay structure for the display and return the screen
* number too.
*
* Results:
* The return value is a pointer to information about the display,
* or NULL if the display couldn't be opened. In this case, an
* error message is left in interp->result. The location at
* *screenPtr is overwritten with the screen number parsed from
* screenName.
*
* Side effects:
* A new connection is opened to the display if there is no
* connection already. A new TkDisplay data structure is also
* setup, if necessary.
*
*----------------------------------------------------------------------
*/
static TkDisplay *
char *screenName; /* Name for screen. NULL or empty means
* use DISPLAY envariable. */
int *screenPtr; /* Where to store screen number. */
{
char *p;
int screenId;
/*
* Separate the screen number from the rest of the display
* name. ScreenName is assumed to have the syntax
* <display>.<screen> with the dot and the screen being
* optional.
*/
if (screenName == NULL) {
"no display name and no $DISPLAY environment variable";
}
screenId = 0;
p--;
}
if ((*p == '.') && (p[1] != '\0')) {
length = p - screenName;
}
/*
* See if we already have a connection to this display. If not,
* then open a new connection.
*/
}
dispPtr->numModKeyCodes = 0;
dispPtr->deleteCount = 0;
dispPtr->clipboardActive = 0;
dispPtr->destroyCount = 0;
dispPtr->lastDestroyRequest = 0;
dispPtr->forceFocus = 0;
break;
}
break;
}
}
}
return dispPtr;
}
/*
*----------------------------------------------------------------------
*
* TkGetDisplay --
*
* Given an X display, TkGetDisplay returns the TkDisplay
* structure for the display.
*
* Results:
* The return value is a pointer to information about the display,
* or NULL if the display did not have a TkDisplay structure.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
{
break;
}
}
return dispPtr;
}
/*
*--------------------------------------------------------------
*
* AllocWindow --
*
* This procedure creates and initializes a TkWindow structure.
*
* Results:
* The return value is a pointer to the new window.
*
* Side effects:
* A new window structure is allocated and all its fields are
* initialized.
*
*--------------------------------------------------------------
*/
static TkWindow *
int screenNum; /* Index of screen for new window. */
* inherit visual information. NULL means
* use screen defaults instead of
* inheriting. */
{
} else {
}
} else {
}
#ifdef TK_USE_INPUT_METHODS
#endif /* TK_USE_INPUT_METHODS */
winPtr->internalBorderWidth = 0;
return winPtr;
}
/*
*----------------------------------------------------------------------
*
* NameWindow --
*
* This procedure is invoked to give a window a name and insert
* the window into the hierarchy associated with a particular
* application.
*
* Results:
* A standard Tcl return value.
*
* Side effects:
* See above.
*
*----------------------------------------------------------------------
*/
static int
* (used for naming, options, etc.). */
char *name; /* Name for winPtr; must be unique among
* parentPtr's children. */
{
char *pathName;
int new;
/*
* Setup all the stuff except name right away, then do the name stuff
* last. This is so that if the name stuff fails, everything else
* will be properly initialized (needed to destroy the window cleanly
* after the naming failure).
*/
} else {
}
/*
* Don't permit names that start with an upper-case letter: this
* will just cause confusion with class names in the option database.
*/
"window name starts with an upper-case letter: \"",
return TCL_ERROR;
}
/*
* To permit names of arbitrary length, must be prepared to malloc
* a buffer to hold the new path name. To run fast in the common
* case where names are short, use a fixed-size buffer on the
* stack.
*/
} else {
}
if (length1 == 1) {
pathName[0] = '.';
} else {
}
if (pathName != staticSpace) {
}
if (!new) {
"\" already exists in parent", (char *) NULL);
return TCL_ERROR;
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* TkCreateMainWindow --
*
* Make a new main window. A main window is a special kind of
* top-level window used as the outermost window in an
* application.
*
* Results:
* The return value is a token for the new window, or NULL if
* an error prevented the new window from being created. If
* NULL is returned, an error message will be left in
* interp->result.
*
* Side effects:
* A new window structure is allocated locally; "interp" is
* associated with the window and registered for "send" commands
* under "baseName". BaseName may be extended with an instance
* number in the form "#2" if necessary to make it globally
* unique. Tk-related commands are bound into interp.
*
*----------------------------------------------------------------------
*/
char *screenName; /* Name of screen on which to create
* window. Empty or NULL string means
* use DISPLAY environment variable. */
char *baseName; /* Base name for application; usually of the
* form "prog instance". */
{
int dummy;
/*
* Panic if someone updated the TkWindow structure without
* also updating the Tk_FakeWin structure (or vice versa).
*/
if (sizeof(TkWindow) != sizeof(Tk_FakeWin)) {
panic("TkWindow and Tk_FakeWin are not the same size");
}
/*
* Create the basic TkWindow structure.
*/
return NULL;
}
/*
* Create the TkMainInfo structure for this application, and set
* up name-related information for the new window.
*/
mainPtr->focusSerial = 0;
mainPtr->strictMotif = 0;
TCL_LINK_BOOLEAN) != TCL_OK) {
}
/*
* Register the interpreter for "send" purposes.
*/
/*
* Bind in Tk's commands.
*/
(ClientData) tkwin,
}
/*
* Set variables for the intepreter.
*/
return tkwin;
}
/*
*--------------------------------------------------------------
*
* Tk_CreateWindow --
*
* Create a new internal or top-level window as a child of an
* existing window.
*
* Results:
* The return value is a token for the new window. This
* is not the same as X's token for the window. If an error
* occurred in creating the window (e.g. no such display or
* screen), then an error message is left in interp->result and
* NULL is returned.
*
* Side effects:
* A new window structure is allocated locally. An X
* window is not initially created, but will be created
* the first time the window is mapped.
*
*--------------------------------------------------------------
*/
* Interp->result is assumed to be
* initialized by the caller. */
char *name; /* Name for new window. Must be unique
* among parent's children. */
char *screenName; /* If NULL, new window will be internal on
* same screen as its parent. If non-NULL,
* gives name of screen on which to create
* new window; window will be a top-level
* window. */
{
"can't create window: parent has been destroyed",
(char *) NULL);
return NULL;
}
if (screenName == NULL) {
return NULL;
} else {
}
} else {
}
}
/*
*----------------------------------------------------------------------
*
* Tk_CreateWindowFromPath --
*
* This procedure is similar to Tk_CreateWindow except that
* it uses a path name to create the window, rather than a
* parent and a child name.
*
* Results:
* The return value is a token for the new window. This
* is not the same as X's token for the window. If an error
* occurred in creating the window (e.g. no such display or
* screen), then an error message is left in interp->result and
* NULL is returned.
*
* Side effects:
* A new window structure is allocated locally. An X
* window is not initially created, but will be created
* the first time the window is mapped.
*
*----------------------------------------------------------------------
*/
* Interp->result is assumed to be
* initialized by the caller. */
* that is to contain new window. */
char *pathName; /* Path name for new window within the
* application of tkwin. The parent of
* this window must already exist, but
* the window itself must not exist. */
char *screenName; /* If NULL, new window will be on same
* screen as its parent. If non-NULL,
* gives name of screen on which to create
* new window; window will be a top-level
* window. */
{
char *p;
int numChars;
/*
* Strip the parent's name out of pathName (it's everything up
* to the last dot). There are two tricky parts: (a) must
* copy the parent's name somewhere else to avoid modifying
* the pathName string (for large names, space for the copy
* will have to be malloc'ed); (b) must special-case the
* situation where the parent is ".".
*/
if (p == NULL) {
"\"", (char *) NULL);
return NULL;
}
if (numChars > FIXED_SPACE) {
} else {
p = fixedSpace;
}
if (numChars == 0) {
*p = '.';
p[1] = '\0';
} else {
p[numChars] = '\0';
}
/*
* Find the parent window.
*/
if (p != fixedSpace) {
ckfree(p);
}
return NULL;
}
"can't create window: parent has been destroyed", (char *) NULL);
return NULL;
}
/*
* Create the window.
*/
if (screenName == NULL) {
!= TCL_OK) {
return NULL;
} else {
}
} else {
}
}
/*
*--------------------------------------------------------------
*
* Tk_DestroyWindow --
*
* Destroy an existing window. After this call, the caller
* should never again use the token.
*
* Results:
* None.
*
* Side effects:
* The window is deleted, along with all of its children.
* Relevant callback procedures are invoked.
*
*--------------------------------------------------------------
*/
void
{
/*
* A destroy event binding caused the window to be destroyed
* again. Ignore the request.
*/
return;
}
/*
* Some cleanup needs to be done immediately, rather than later,
* because it needs information that will be destoyed before we
* get to the main cleanup point. For example, TkFocusDeadWindow
* needs to access the parentPtr field from a window, but if
* a Destroy event handler deletes the window's parent this
* field will be NULL before the main cleanup point is reached.
*/
/*
* If this is a main window, remove it from the list of main
* windows. This needs to be done now (rather than later with
* all the other main window cleanup) to handle situations where
* a destroy binding for a window calls "exit". In this case
* the child window cleanup isn't complete when exit is called,
* so the reference count of its application doesn't go to zero
* when exit calls Tk_DestroyWindow on ".", so the main window
* doesn't get removed from the list and exit loops infinitely.
* Even worse, if "destroy ." is called by the destroy binding
* before calling "exit", "exit" will attempt to destroy
* mainPtr->winPtr, which no longer exists, and there may be a
* core dump.
*/
} else {
for (prevPtr = tkMainWindowList;
/* Empty loop body. */
}
}
}
/*
* Recursively destroy children.
*/
dispPtr->destroyCount++;
/*
* The child didn't remove itself from the child list, so
* let's remove it here. This can happen in some strange
* conditions, such as when a Delete event handler for a
* window deletes the window's parent.
*/
}
}
/*
* Generate a DestroyNotify event. In order for the DestroyNotify
* event to be processed correctly, need to make sure the window
* exists. This is a bit of a kludge, and may be unnecessarily
* expensive, but without it no event handlers will get called for
* windows that don't exist yet.
*
* Note: if the window's pathName is NULL it means that the window
* was not successfully initialized in the first place, so we should
* not make the window exist or generate the event.
*/
}
}
/*
* Cleanup the data structures associated with this window.
*/
}
#else
/*
* The parent has already been destroyed and this isn't
* a top-level window, so this window will be destroyed
* implicitly when the parent's X window is destroyed;
* it's much faster not to do an explicit destroy of this
* X window.
*/
}
#endif
}
dispPtr->destroyCount--;
#ifdef TK_USE_INPUT_METHODS
}
#endif /* TK_USE_INPUT_METHODS */
}
}
/*
* We just deleted the last window in the application. Delete
* the TkMainInfo structure too and replace all of Tk's commands
* with dummy commands that return errors. Also delete the
* "send" command to unregister the interpreter.
*
* NOTE: Only replace the commands it if the interpreter is
* not being deleted. If it *is*, the interpreter cleanup will
* do all the needed work.
*/
}
}
}
}
}
/*
*--------------------------------------------------------------
*
* Tk_MapWindow --
*
* Map a window within its parent. This may require the
*
* Results:
* None.
*
* Side effects:
* The given window will be mapped. Windows may also
* be created.
*
*--------------------------------------------------------------
*/
void
{
return;
}
}
/*
* Lots of special processing has to be done for top-level
* windows. Let tkWm.c handle everything itself.
*/
return;
}
}
/*
*--------------------------------------------------------------
*
* Tk_MakeWindowExist --
*
* Ensure that a particular window actually exists. This
* procedure shouldn't normally need to be invoked from
* outside the Tk package, but may be needed if someone
* wants to manipulate a window before mapping it.
*
* Results:
* None.
*
* Side effects:
* When the procedure returns, the X window associated with
* tkwin is guaranteed to exist. This may require the
* window's ancestors to be created also.
*
*--------------------------------------------------------------
*/
void
{
int new;
return;
}
} else {
}
}
winPtr->dirtyChanges = 0;
#ifdef TK_USE_INPUT_METHODS
#endif /* TK_USE_INPUT_METHODS */
/*
* If any siblings higher up in the stacking order have already
* been created then move this window to its rightful position
* in the stacking order.
*
* NOTE: this code ignores any changes anyone might have made
* to the sibling and stack_mode field of the window's attributes,
* so it really isn't safe for these to be manipulated except
* by calling Tk_RestackWindow.
*/
break;
}
}
/*
* If this window has a different colormap than its parent, add
* the window to the WM_COLORMAP_WINDOWS property for its top-level.
*/
}
}
/*
* Issue a ConfigureNotify event if there were deferred configuration
* changes (but skip it if the window is being deleted; the
* ConfigureNotify event could cause problems if we're being called
* from Tk_DestroyWindow under some conditions).
*/
}
}
/*
*--------------------------------------------------------------
*
* Tk_UnmapWindow, etc. --
*
* There are several procedures under here, each of which
* mirrors an existing X procedure. In addition to performing
* the functions of the corresponding procedure, each
* procedure also updates the local window structure and
* synthesizes an X event (if the window's structure is being
* managed internally).
*
* Results:
* See the manual entries.
*
* Side effects:
* See the manual entries.
*
*--------------------------------------------------------------
*/
void
{
return;
}
/*
* Special processing has to be done for top-level windows. Let
* tkWm.c handle everything itself.
*/
return;
}
}
}
void
unsigned int valueMask; /* Mask indicating which parts of
* *valuePtr are to be used. */
{
}
}
}
}
if (valueMask & CWBorderWidth) {
}
panic("Can't set sibling or stack mode from Tk_ConfigureWindow.");
}
}
} else {
}
}
void
int x, y; /* New location for window (within
* parent). */
{
}
} else {
}
}
void
{
(unsigned) height);
}
} else {
}
}
void
int x, y; /* New location for window (within
* parent). */
{
}
} else {
}
}
void
int width; /* New border width for window. */
{
(unsigned) width);
}
} else {
}
}
void
unsigned long valueMask; /* OR'ed combination of bits,
* indicating which fields of
* *attsPtr are to be used. */
register XSetWindowAttributes *attsPtr;
/* New values for some attributes. */
{
if (valueMask & CWBackPixmap) {
}
if (valueMask & CWBackPixel) {
}
if (valueMask & CWBorderPixmap) {
}
if (valueMask & CWBorderPixel) {
}
if (valueMask & CWBitGravity) {
}
if (valueMask & CWWinGravity) {
}
if (valueMask & CWBackingStore) {
}
if (valueMask & CWBackingPlanes) {
}
if (valueMask & CWBackingPixel) {
}
if (valueMask & CWOverrideRedirect) {
}
if (valueMask & CWSaveUnder) {
}
if (valueMask & CWEventMask) {
}
if (valueMask & CWDontPropagate) {
}
if (valueMask & CWColormap) {
}
}
} else {
}
}
void
unsigned long pixel; /* Pixel value to use for
* window's background. */
{
} else {
| CWBackPixel;
}
}
void
* background. */
{
} else {
| CWBackPixmap;
}
}
void
unsigned long pixel; /* Pixel value to use for
* window's border. */
{
} else {
}
}
void
* border. */
{
} else {
}
}
void
{
#ifdef MAC_TCL
#else
#endif
} else {
}
}
void
{
}
void
{
}
} else {
}
}
/*
*----------------------------------------------------------------------
*
* Tk_SetWindowVisual --
*
* This procedure is called to specify a visual to be used
* for a Tk window when it is created. This procedure, if
* called at all, must be called before the X window is created
* (i.e. before Tk_MakeWindowExist is called).
*
* Results:
* The return value is 1 if successful, or 0 if the X window has
* been already created.
*
* Side effects:
* The information given is stored for when the window is created.
*
*----------------------------------------------------------------------
*/
int
int depth; /* New depth for window. */
{
/* Too late! */
return 0;
}
/*
* The following code is needed to make sure that the window doesn't
* inherit the parent's border pixmap, which would result in a BadMatch
* error.
*/
}
return 1;
}
/*
*----------------------------------------------------------------------
*
* DoConfigureNotify --
*
* Generate a ConfigureNotify event describing the current
* configuration of a window.
*
* Results:
* None.
*
* Side effects:
* An event is generated and processed by Tk_HandleEvent.
*
*----------------------------------------------------------------------
*/
static void
* was just changed. */
{
} else {
}
}
/*
*----------------------------------------------------------------------
*
* Tk_SetClass --
*
* This procedure is used to give a window a class.
*
* Results:
* None.
*
* Side effects:
* A new class is stored for tkwin, replacing any existing
* class for it.
*
*----------------------------------------------------------------------
*/
void
char *className; /* New class for tkwin. */
{
}
}
/*
*----------------------------------------------------------------------
*
* Tk_NameToWindow --
*
* Given a string name for a window, this procedure
* returns the token for the window, if there exists a
* window corresponding to the given name.
*
* Results:
* The return result is either a token for the window corresponding
* to "name", or else NULL to indicate that there is no such
* window. In this case, an error message is left in interp->result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
char *pathName; /* Path name of window. */
* belong to the same main window as tkwin. */
{
pathName);
return NULL;
}
}
/*
*----------------------------------------------------------------------
*
* Tk_IdToWindow --
*
* Given an X display and window ID, this procedure returns the
* Tk token for the window, if there exists a Tk window corresponding
* to the given ID.
*
* Results:
* The return result is either a token for the window corresponding
* to the given X id, or else NULL to indicate that there is no such
* window.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
{
return NULL;
}
break;
}
}
return NULL;
}
}
/*
*----------------------------------------------------------------------
*
* Tk_DisplayName --
*
* Return the textual name of a window's display.
*
* Results:
* The return value is the string name of the display associated
* with tkwin.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
char *
{
}
/*
*----------------------------------------------------------------------
*
* UnlinkWindow --
*
* This procedure removes a window from the childList of its
* parent.
*
* Results:
* None.
*
* Side effects:
* The window is unlinked from its childList.
*
*----------------------------------------------------------------------
*/
static void
{
return;
}
}
} else {
panic("UnlinkWindow couldn't find child in parent");
}
}
}
}
}
/*
*----------------------------------------------------------------------
*
* Tk_RestackWindow --
*
* Change a window's position in the stacking order.
*
* Results:
* TCL_OK is normally returned. If other is not a descendant
* of tkwin's parent then TCL_ERROR is returned and tkwin is
* not repositioned.
*
* Side effects:
* Tkwin is repositioned in the stacking order.
*
*----------------------------------------------------------------------
*/
int
* the stacking order is to change. */
int aboveBelow; /* Indicates new position of tkwin relative
* to other; must be Above or Below. */
* puts it just above or below this window.
* If NULL then tkwin goes above or below
* all windows in the same parent. */
{
unsigned int mask;
/*
* Special case: if winPtr is a top-level window then just find
* the top-level ancestor of otherPtr and restack winPtr above
* otherPtr without changing any of Tk's childLists.
*/
mask = CWStackMode;
}
return TCL_OK;
}
/*
* Find an ancestor of otherPtr that is a sibling of winPtr.
*/
/*
* Window is going to be deleted shortly; don't do anything.
*/
return TCL_OK;
}
if (aboveBelow == Above) {
} else {
}
} else {
return TCL_ERROR;
}
}
}
return TCL_OK;
}
/*
* Reposition winPtr in the stacking order.
*/
if (aboveBelow == Above) {
}
} else {
} else {
}
}
}
/*
* Notify the X server of the change. If winPtr hasn't yet been
* created then there's no need to tell the X server now, since
* the stacking order will be handled properly when the window
* is finally created.
*/
break;
}
}
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* Tk_MainWindow --
*
* Returns the main window for an application.
*
* Results:
* If interp has a Tk application associated with it, the main
* window for the application is returned. Otherwise NULL is
* returned and an error message is left in interp->result.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
* application. Used for error
* reporting also. */
{
}
}
return NULL;
}
/*
*----------------------------------------------------------------------
*
* Tk_StrictMotif --
*
* Indicates whether strict Motif compliance has been specified
* for the given window.
*
* Results:
* The return value is 1 if strict Motif compliance has been
* requested for tkwin's application by setting the tk_strictMotif
* variable in its interpreter to a true value. 0 is returned
* if tk_strictMotif has a false value.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
* to be checked. */
{
}
/*
*--------------------------------------------------------------
*
* OpenIM --
*
* Tries to open an X input method, associated with the
* given display. Right now we can only deal with a bare-bones
* input style: no preedit, and no status.
*
* Results:
* Stores the input method in dispPtr->inputMethod; if there isn't
* a suitable input method, then NULL is stored in dispPtr->inputMethod.
*
* Side effects:
* An input method gets opened.
*
*--------------------------------------------------------------
*/
static void
{
#ifndef TK_USE_INPUT_METHODS
return;
#else
unsigned short i;
return;
}
goto error;
}
for (i = 0; i < stylePtr->count_styles; i++) {
if (stylePtr->supported_styles[i]
== (XIMPreeditNothing|XIMStatusNothing)) {
return;
}
}
/*
* Should close the input method, but this causes core dumps on some
* systems (e.g. Solaris 2.3 as of 1/6/95).
* XCloseIM(dispPtr->inputMethod);
*/
return;
#endif /* TK_USE_INPUT_METHODS */
}
/*
*----------------------------------------------------------------------
*
* Tk_GetNumMainWindows --
*
* This procedure returns the number of main windows currently
* open in this process.
*
* Results:
* The number of main windows open in this process.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
int
{
return numMainWindows;
}
/*
*----------------------------------------------------------------------
*
* DeleteWindowsExitProc --
*
* This procedure is invoked as an exit handler. It deletes all
* of the main windows in the process.
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
{
while (tkMainWindowList != NULL) {
}
}
/*
*----------------------------------------------------------------------
*
* Tk_Init --
*
* This procedure is invoked to add Tk to an interpreter. It
* incorporates all of Tk's commands into the interpreter and
* creates the main window for a new Tk application. If the
* interpreter contains a variable "argv", this procedure
* extracts several arguments from that variable, uses them
* to configure the main window, and modifies argv to exclude
* the arguments (see the "wish" documentation for a list of
* the arguments that are extracted).
*
* Results:
* Returns a standard Tcl completion code and sets interp->result
* if there is an error.
*
* Side effects:
* Depends on various initialization scripts that get invoked.
*
*----------------------------------------------------------------------
*/
int
{
char *p;
/*
* If there is an "argv" variable, get its value, extract out
* relevant arguments from it, and rewrite the variable without
* the arguments that we used.
*/
synchronize = 0;
if (p != NULL) {
"\n (processing arguments in argv variable)");
return TCL_ERROR;
}
!= TCL_OK) {
goto argError;
}
ckfree(p);
}
/*
* Figure out the application's name and class.
*/
name = "tk";
} else {
if (p != NULL) {
name = p+1;
}
}
}
p = Tcl_DStringValue(&class);
}
/*
* Create an argument list for creating the top-level window,
* using the information parsed from argv, if any.
*/
args[0] = "toplevel";
argc = 4;
argc += 2;
/*
* If this is the first application for this process, save
* the display name in the DISPLAY environment variable so
* that it will be available to subprocesses created by us.
*/
if (numMainWindows == 0) {
}
}
argc += 2;
}
argc += 2;
}
goto done;
}
if (synchronize) {
}
/*
* Set the geometry of the main window, if requested. Put the
* requested geometry into the "geometry" variable.
*/
goto done;
}
}
goto done;
}
goto done;
}
/*
* Invoke platform-specific initialization.
*/
done:
}
return code;
}