summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjenglish <jenglish@noemail.net>2002-06-14 22:25:10 (GMT)
committerjenglish <jenglish@noemail.net>2002-06-14 22:25:10 (GMT)
commitbe685bc42b5fe903a17f680bd393334fa7c13821 (patch)
treedb4f9b64945413c671514dd1b7f254700c3649cb /generic
parent241fbc3cb710c0d571462fabfe1337a9cc9f3fa1 (diff)
downloadtk-be685bc42b5fe903a17f680bd393334fa7c13821.zip
tk-be685bc42b5fe903a17f680bd393334fa7c13821.tar.gz
tk-be685bc42b5fe903a17f680bd393334fa7c13821.tar.bz2
TIP #47 "Modifying Tk to Allow Writing X Window managers"
(patch from Neil McKay). * Add CirculateRequest, Create, MapRequest, ResizeRequest, and ConfigureRequest event types; * Split TK_TOPLEVEL flag into TK_TOPLEVEL, TK_HAS_WRAPPER, TK_WIN_MANAGED, and TK_TOP_HIERARCHY. FossilOrigin-Name: ad38fbacd7328c607131ee691e933fcc9aa67d3e
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.h28
-rw-r--r--generic/tkBind.c105
-rw-r--r--generic/tkCanvWind.c8
-rw-r--r--generic/tkCmds.c8
-rw-r--r--generic/tkEvent.c129
-rw-r--r--generic/tkFocus.c6
-rw-r--r--generic/tkGrab.c16
-rw-r--r--generic/tkGrid.c6
-rw-r--r--generic/tkImage.c4
-rw-r--r--generic/tkPack.c10
-rw-r--r--generic/tkPlace.c6
-rw-r--r--generic/tkPointer.c4
-rw-r--r--generic/tkTextWind.c10
-rw-r--r--generic/tkWindow.c34
14 files changed, 300 insertions, 74 deletions
diff --git a/generic/tk.h b/generic/tk.h
index 81e6e36..babc9bf 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk.h,v 1.60 2002/06/14 14:07:51 dkf Exp $
+ * RCS: @(#) $Id: tk.h,v 1.61 2002/06/14 22:25:11 jenglish Exp $
*/
#ifndef _TK
@@ -715,6 +715,12 @@ typedef XActivateDeactivateEvent XDeactivateEvent;
(((Tk_FakeWin *) (tkwin))->flags & TK_MAPPED)
#define Tk_IsTopLevel(tkwin) \
(((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL)
+#define Tk_HasWrapper(tkwin) \
+ (((Tk_FakeWin *) (tkwin))->flags & TK_HAS_WRAPPER)
+#define Tk_WinManaged(tkwin) \
+ (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED)
+#define Tk_TopWinHierarchy(tkwin) \
+ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY)
#define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth)
#define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight)
/* Tk_InternalBorderWidth is deprecated */
@@ -792,9 +798,7 @@ typedef struct Tk_FakeWin {
*
* TK_MAPPED: 1 means window is currently mapped,
* 0 means unmapped.
- * TK_TOP_LEVEL: 1 means this is a top-level window (it
- * was or will be created as a child of
- * a root window).
+ * TK_TOP_LEVEL: 1 means this is a top-level widget.
* TK_ALREADY_DEAD: 1 means the window is in the process of
* being destroyed already.
* TK_NEED_CONFIG_NOTIFY: 1 means that the window has been reconfigured
@@ -846,6 +850,18 @@ typedef struct Tk_FakeWin {
* special Unix menubar windows.
* TK_ANONYMOUS_WINDOW: 1 means that this window has no name, and is
* thus not accessible from Tk.
+ * TK_HAS_WRAPPER 1 means that this window has a wrapper window
+ * TK_WIN_MANAGED 1 means that this window is a child of the
+ * root window, and is managed by the window
+ * manager.
+ * TK_TOP_HIERARCHY 1 means this window is at the top of a
+ * physical window hierarchy within this
+ * process, i.e. the window's parent
+ * either doesn't exist or is not owned by
+ * this Tk application.
+ * TK_PROP_PROPCHANGE 1 means that PropertyNotify events in
+ * this window's children should propagate
+ * up to this window.
*/
@@ -864,6 +880,10 @@ typedef struct Tk_FakeWin {
#define TK_WRAPPER 0x1000
#define TK_REPARENTED 0x2000
#define TK_ANONYMOUS_WINDOW 0x4000
+#define TK_HAS_WRAPPER 0x8000
+#define TK_WIN_MANAGED 0x10000
+#define TK_TOP_HIERARCHY 0x20000
+#define TK_PROP_PROPCHANGE 0x40000
/*
*--------------------------------------------------------------
diff --git a/generic/tkBind.c b/generic/tkBind.c
index fa6a31a..4ca6ca5 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkBind.c,v 1.21 2002/01/25 21:09:36 dgp Exp $
+ * RCS: @(#) $Id: tkBind.c,v 1.22 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -506,6 +506,11 @@ static EventInfo eventArray[] = {
{"Activate", ActivateNotify, ActivateMask},
{"Deactivate", DeactivateNotify, ActivateMask},
{"MouseWheel", MouseWheelEvent, MouseWheelMask},
+ {"CirculateRequest", CirculateRequest, SubstructureRedirectMask},
+ {"ConfigureRequest", ConfigureRequest, SubstructureRedirectMask},
+ {"Create", CreateNotify, SubstructureNotifyMask},
+ {"MapRequest", MapRequest, SubstructureRedirectMask},
+ {"ResizeRequest", ResizeRequest, ResizeRedirectMask},
{(char *) NULL, 0, 0}
};
static Tcl_HashTable eventTable;
@@ -537,6 +542,10 @@ static Tcl_HashTable eventTable;
#define COLORMAP 0x10000
#define VIRTUAL 0x20000
#define ACTIVATE 0x40000
+#define MAPREQ 0x80000
+#define CONFIGREQ 0x100000
+#define RESIZEREQ 0x200000
+#define CIRCREQ 0x400000
#define KEY_BUTTON_MOTION_VIRTUAL (KEY|BUTTON|MOTION|VIRTUAL)
@@ -561,12 +570,12 @@ static int flagArray[TK_LASTEVENT] = {
/* DestroyNotify */ DESTROY,
/* UnmapNotify */ UNMAP,
/* MapNotify */ MAP,
- /* MapRequest */ 0,
+ /* MapRequest */ MAPREQ,
/* ReparentNotify */ REPARENT,
/* ConfigureNotify */ CONFIG,
- /* ConfigureRequest */ 0,
+ /* ConfigureRequest */ CONFIGREQ,
/* GravityNotify */ GRAVITY,
- /* ResizeRequest */ 0,
+ /* ResizeRequest */ RESIZEREQ,
/* CirculateNotify */ CIRC,
/* CirculateRequest */ 0,
/* PropertyNotify */ PROP,
@@ -636,6 +645,22 @@ static TkStateMap visNotify[] = {
{-1, NULL}
};
+static TkStateMap configureRequestDetail[] = {
+ {None, "None"},
+ {Above, "Above"},
+ {Below, "Below"},
+ {BottomIf, "BottomIf"},
+ {TopIf, "TopIf"},
+ {Opposite, "Opposite"},
+ {-1, NULL}
+};
+
+static TkStateMap propNotify[] = {
+ {PropertyNewValue, "NewValue"},
+ {PropertyDelete, "Delete"},
+ {-1, NULL}
+};
+
/*
* Prototypes for local procedures defined in this file:
*/
@@ -2032,6 +2057,10 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
}
goto nextEvent;
}
+ if (eventPtr->xany.type == CreateNotify
+ && eventPtr->xcreatewindow.parent != window) {
+ goto nextSequence;
+ } else
if (eventPtr->xany.window != window) {
goto nextSequence;
}
@@ -2245,6 +2274,7 @@ MatchPatterns(dispPtr, bindPtr, psPtr, bestPtr, objectPtr, sourcePtrPtr)
*sourcePtrPtr = bestSourcePtr;
return bestPtr;
}
+
/*
*--------------------------------------------------------------
@@ -2343,6 +2373,14 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
}
string = TkFindStateString(notifyDetail, number);
}
+ else if (flags & CONFIGREQ) {
+ if (eventPtr->xconfigurerequest.value_mask & CWStackMode) {
+ string = TkFindStateString(configureRequestDetail,
+ eventPtr->xconfigurerequest.detail);
+ } else {
+ string = "";
+ }
+ }
goto doString;
case 'f':
number = eventPtr->xcrossing.focus;
@@ -2353,7 +2391,26 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
} else if (flags & (CONFIG)) {
number = eventPtr->xconfigure.height;
}
+ else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.height;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.height;
+ } else if (flags & RESIZEREQ) {
+ number = eventPtr->xresizerequest.height;
+ }
goto doNumber;
+ case 'i':
+ if (flags & CREATE) {
+ TkpPrintWindowId(numStorage, eventPtr->xcreatewindow.window);
+ } else if (flags & CONFIGREQ) {
+ TkpPrintWindowId(numStorage, eventPtr->xconfigurerequest.window);
+ } else if (flags & MAPREQ) {
+ TkpPrintWindowId(numStorage, eventPtr->xmaprequest.window);
+ } else {
+ TkpPrintWindowId(numStorage, eventPtr->xany.window);
+ }
+ string = numStorage;
+ goto doString;
case 'k':
number = eventPtr->xkey.keycode;
goto doNumber;
@@ -2377,13 +2434,21 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
}
goto doNumber;
case 'p':
- string = TkFindStateString(circPlace, eventPtr->xcirculate.place);
+ if (flags & CIRC) {
+ string = TkFindStateString(circPlace, eventPtr->xcirculate.place);
+ } else if (flags & CIRCREQ) {
+ string = TkFindStateString(circPlace, eventPtr->xcirculaterequest.place);
+ }
goto doString;
case 's':
if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
number = eventPtr->xkey.state;
} else if (flags & CROSSING) {
number = eventPtr->xcrossing.state;
+ } else if (flags & PROP) {
+ string = TkFindStateString(propNotify,
+ eventPtr->xproperty.state);
+ goto doString;
} else if (flags & VISIBILITY) {
string = TkFindStateString(visNotify,
eventPtr->xvisibility.state);
@@ -2408,6 +2473,13 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
} else if (flags & CONFIG) {
number = eventPtr->xconfigure.width;
}
+ else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.width;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.width;
+ } else if (flags & RESIZEREQ) {
+ number = eventPtr->xresizerequest.width;
+ }
goto doNumber;
case 'x':
if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
@@ -2421,6 +2493,11 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
} else if (flags & REPARENT) {
number = eventPtr->xreparent.x;
}
+ else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.x;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.x;
+ }
goto doNumber;
case 'y':
if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) {
@@ -2435,6 +2512,11 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
number = eventPtr->xcrossing.y;
}
+ else if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.y;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.y;
+ }
goto doNumber;
case 'A':
if (flags & KEY) {
@@ -2443,7 +2525,13 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
}
goto doString;
case 'B':
- number = eventPtr->xcreatewindow.border_width;
+ if (flags & CREATE) {
+ number = eventPtr->xcreatewindow.border_width;
+ } else if (flags & CONFIGREQ) {
+ number = eventPtr->xconfigurerequest.border_width;
+ } else {
+ number = eventPtr->xconfigure.border_width;
+ }
goto doNumber;
case 'D':
/*
@@ -2468,6 +2556,11 @@ ExpandPercents(winPtr, before, eventPtr, keySym, dsPtr)
case 'N':
number = (int) keySym;
goto doNumber;
+ case 'P':
+ if (flags & PROP) {
+ string = Tk_GetAtomName(winPtr, eventPtr->xproperty.atom);
+ }
+ goto doString;
case 'R':
TkpPrintWindowId(numStorage, eventPtr->xkey.root);
string = numStorage;
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index ed218b2..65d09bd 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvWind.c,v 1.5 2001/07/03 06:03:44 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvWind.c,v 1.6 2002/06/14 22:25:12 jenglish Exp $
*/
#include <stdio.h>
@@ -353,7 +353,7 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
/*
* Make sure that the canvas is either the parent of the
* window associated with the item or a descendant of that
- * parent. Also, don't allow a top-level window to be
+ * parent. Also, don't allow a top-of-hierarchy window to be
* managed inside a canvas.
*/
@@ -363,7 +363,7 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
if (ancestor == parent) {
break;
}
- if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_LEVEL) {
+ if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_AppendResult(interp, "can't use ",
Tk_PathName(winItemPtr->tkwin),
@@ -372,7 +372,7 @@ ConfigureWinItem(interp, canvas, itemPtr, objc, objv, flags)
return TCL_ERROR;
}
}
- if (((Tk_FakeWin *) (winItemPtr->tkwin))->flags & TK_TOP_LEVEL) {
+ if (((Tk_FakeWin *) (winItemPtr->tkwin))->flags & TK_TOP_HIERARCHY) {
goto badWindow;
}
if (winItemPtr->tkwin == canvasTkwin) {
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index c1b6275..1ef3361 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCmds.c,v 1.23 2002/03/20 22:55:16 dgp Exp $
+ * RCS: @(#) $Id: tkCmds.c,v 1.24 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -270,7 +270,7 @@ TkBindEventProc(winPtr, eventPtr)
objPtr[0] = (ClientData) winPtr->pathName;
objPtr[1] = (ClientData) winPtr->classUid;
for (topLevPtr = winPtr;
- (topLevPtr != NULL) && !(topLevPtr->flags & TK_TOP_LEVEL);
+ (topLevPtr != NULL) && !(topLevPtr->flags & TK_TOP_HIERARCHY);
topLevPtr = topLevPtr->parentPtr) {
/* Empty loop body. */
}
@@ -337,7 +337,7 @@ Tk_BindtagsObjCmd(clientData, interp, objc, objv)
Tcl_ListObjAppendElement(interp, listPtr,
Tcl_NewStringObj(winPtr->classUid, -1));
winPtr2 = winPtr;
- while ((winPtr2 != NULL) && !(Tk_IsTopLevel(winPtr2))) {
+ while ((winPtr2 != NULL) && !(Tk_TopWinHierarchy(winPtr2))) {
winPtr2 = winPtr2->parentPtr;
}
if ((winPtr != winPtr2) && (winPtr2 != NULL)) {
@@ -1246,7 +1246,7 @@ Tk_WinfoObjCmd(clientData, interp, objc, objv)
if ((winPtr == NULL) || !(winPtr->flags & TK_MAPPED)) {
break;
}
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
viewable = 1;
break;
}
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 9ad96d1..4f40873 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkEvent.c,v 1.9 2002/04/05 08:41:07 hobbs Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.10 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -519,6 +519,91 @@ TkEventInit _ANSI_ARGS_((void))
/*
*--------------------------------------------------------------
*
+ * TkXErrorHandler --
+ *
+ * TkXErrorHandler is an error handler, to be installed
+ * via Tk_CreateErrorHandler, that will set a flag if an
+ * X error occurred.
+ *
+ * Results:
+ * Always returns 0, indicating that the X error was
+ * handled.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+static int
+TkXErrorHandler (clientData, errEventPtr)
+ ClientData clientData; /* Pointer to flag we set */
+ XErrorEvent *errEventPtr; /* X error info */
+{
+ int *error;
+
+ error = (int *) clientData;
+ *error = 1;
+ return 0;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
+ * ParentXId --
+ *
+ * Returns the parent of the given window, or "None"
+ * if the window doesn't exist.
+ *
+ * Results:
+ * Returns an X window ID.
+ *
+ * Side effects:
+ * None.
+ *
+ *--------------------------------------------------------------
+ */
+
+static Window
+ParentXId(display, w)
+ Display *display;
+ Window w;
+{
+ Tk_ErrorHandler handler;
+ int gotXError;
+ Status status;
+ Window parent;
+ Window root;
+ Window *childList;
+ unsigned int nChildren;
+
+ /* Handle errors ourselves. */
+
+ gotXError = 0;
+ handler = Tk_CreateErrorHandler(display, -1, -1, -1,
+ TkXErrorHandler, (ClientData) (&gotXError));
+
+ /* Get the parent window. */
+
+ status = XQueryTree(display, w, &root, &parent, &childList, &nChildren);
+
+ /* Do some cleanup; gotta return "None" if we got an error. */
+
+ Tk_DeleteErrorHandler(handler);
+ XSync(display, False);
+ if (status != 0 && childList != NULL) {
+ XFree(childList);
+ }
+ if (status == 0) {
+ parent = None;
+ }
+
+ return parent;
+}
+
+/*
+ *--------------------------------------------------------------
+ *
* Tk_HandleEvent --
*
* Given an event, invoke all the handlers that have
@@ -544,6 +629,7 @@ Tk_HandleEvent(eventPtr)
unsigned long mask;
InProgress ip;
Window handlerWindow;
+ Window parentXId;
TkDisplay *dispPtr;
Tcl_Interp *interp = (Tcl_Interp *) NULL;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
@@ -655,18 +741,38 @@ Tk_HandleEvent(eventPtr)
}
winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, handlerWindow);
if (winPtr == NULL) {
-
/*
* There isn't a TkWindow structure for this window.
* However, if the event is a PropertyNotify event then call
* the selection manager (it deals beneath-the-table with
- * certain properties).
+ * certain properties). Also, if the window's parent is a
+ * Tk window that has the TK_PROP_PROPCHANGE flag set, then
+ * we must propagate the PropertyNotify event up to the parent.
*/
- if (eventPtr->type == PropertyNotify) {
- TkSelPropProc(eventPtr);
+ if (eventPtr->type != PropertyNotify) {
+ return;
}
- return;
+
+ TkSelPropProc(eventPtr);
+
+ /* Get handlerWindow's parent. */
+
+ parentXId = ParentXId(eventPtr->xany.display, handlerWindow);
+ if (parentXId == None) {
+ return;
+ }
+
+ winPtr = (TkWindow *) Tk_IdToWindow(eventPtr->xany.display, parentXId);
+ if (winPtr == NULL) {
+ return;
+ }
+
+ if (!(winPtr->flags & TK_PROP_PROPCHANGE)) {
+ return;
+ }
+
+ handlerWindow = parentXId;
}
/*
@@ -893,7 +999,14 @@ Tk_HandleEvent(eventPtr)
* these events here than in the lower-level procedures.
*/
- if ((ip.winPtr != None) && (mask != SubstructureNotifyMask)) {
+ /*
+ * ...well, except when we use the tkwm patches, in which case
+ * we DO handle CreateNotify events, so we gotta pass 'em through.
+ */
+
+ if ((ip.winPtr != None)
+ && ((mask != SubstructureNotifyMask)
+ || (eventPtr->type == CreateNotify))) {
TkBindEventProc(winPtr, eventPtr);
}
}
@@ -1172,7 +1285,7 @@ TkQueueEventForAllChildren(winPtr, eventPtr)
childPtr = winPtr->childList;
while (childPtr != NULL) {
- if (!Tk_IsTopLevel(childPtr)) {
+ if (!Tk_TopWinHierarchy(childPtr)) {
TkQueueEventForAllChildren(childPtr, eventPtr);
}
childPtr = childPtr->nextPtr;
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index c50fc3d..b1ba279 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFocus.c,v 1.7 2002/04/12 10:03:24 hobbs Exp $
+ * RCS: @(#) $Id: tkFocus.c,v 1.8 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkInt.h"
@@ -216,7 +216,7 @@ Tk_FocusObjCmd(clientData, interp, objc, objv)
}
for (topLevelPtr = newPtr; topLevelPtr != NULL;
topLevelPtr = topLevelPtr->parentPtr) {
- if (topLevelPtr->flags & TK_TOP_LEVEL) {
+ if (topLevelPtr->flags & TK_TOP_HIERARCHY) {
for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr;
tlFocusPtr != NULL;
tlFocusPtr = tlFocusPtr->nextPtr) {
@@ -588,7 +588,7 @@ TkSetFocusWin(winPtr, force)
if (!(topLevelPtr->flags & TK_MAPPED)) {
allMapped = 0;
}
- if (topLevelPtr->flags & TK_TOP_LEVEL) {
+ if (topLevelPtr->flags & TK_TOP_HIERARCHY) {
break;
}
}
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 8c16927..fb32642 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrab.c,v 1.7 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkGrab.c,v 1.8 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -742,7 +742,7 @@ TkPointerEvent(eventPtr, winPtr)
if (eventPtr->xcrossing.send_event != GENERATED_EVENT_MAGIC) {
if ((eventPtr->type == LeaveNotify) &&
- (winPtr->flags & TK_TOP_LEVEL)) {
+ (winPtr->flags & TK_TOP_HIERARCHY)) {
dispPtr->serverWinPtr = NULL;
} else {
dispPtr->serverWinPtr = winPtr;
@@ -941,7 +941,7 @@ TkChangeEventWindow(eventPtr, winPtr)
eventPtr->xmotion.subwindow = None;
for (childPtr = winPtr->childList; childPtr != NULL;
childPtr = childPtr->nextPtr) {
- if (childPtr->flags & TK_TOP_LEVEL) {
+ if (childPtr->flags & TK_TOP_HIERARCHY) {
continue;
}
x = eventPtr->xmotion.x - childPtr->changes.x;
@@ -1226,7 +1226,7 @@ TkGrabDeadWindow(winPtr)
ReleaseButtonGrab(dispPtr);
}
if (dispPtr->serverWinPtr == winPtr) {
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
dispPtr->serverWinPtr = NULL;
} else {
dispPtr->serverWinPtr = winPtr->parentPtr;
@@ -1451,7 +1451,7 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
if (winPtr1 != NULL) {
for (winPtr = winPtr1; winPtr != NULL; winPtr = winPtr->parentPtr) {
winPtr->flags |= TK_GRAB_FLAG;
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
break;
}
}
@@ -1471,7 +1471,7 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
ancestorPtr = winPtr;
break;
}
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
count2++;
break;
}
@@ -1493,7 +1493,7 @@ FindCommonAncestor(winPtr1, winPtr2, countPtr1, countPtr2)
if (winPtr == ancestorPtr) {
count1 = i;
}
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_TOP_HIERARCHY) {
if (count1 == -1) {
count1 = i+1;
}
@@ -1543,7 +1543,7 @@ TkPositionInTree(winPtr, treePtr)
if (winPtr2 == winPtr) {
return TK_GRAB_ANCESTOR;
}
- if (winPtr2->flags & TK_TOP_LEVEL) {
+ if (winPtr2->flags & TK_TOP_HIERARCHY) {
break;
}
}
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 3d2fb40..48db44e 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGrid.c,v 1.20 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkGrid.c,v 1.21 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkInt.h"
@@ -2642,7 +2642,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
return TCL_ERROR;
}
- if (Tk_IsTopLevel(slave)) {
+ if (Tk_TopWinHierarchy(slave)) {
Tcl_AppendResult(interp, "can't manage \"", Tcl_GetString(objv[j]),
"\": it's a top-level window", (char *) NULL);
return TCL_ERROR;
@@ -2806,7 +2806,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (ancestor == parent) {
break;
}
- if (Tk_IsTopLevel(ancestor)) {
+ if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't put ", Tcl_GetString(objv[j]),
" inside ", Tk_PathName(masterPtr->tkwin),
(char *) NULL);
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 38275a8..69b1e19 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkImage.c,v 1.14 2002/02/03 22:33:07 ericm Exp $
+ * RCS: @(#) $Id: tkImage.c,v 1.15 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkInt.h"
@@ -1048,7 +1048,7 @@ Tk_SetTSOrigin(tkwin, gc, x, y)
GC gc;
int x, y;
{
- while (!Tk_IsTopLevel(tkwin)) {
+ while (!Tk_TopWinHierarchy(tkwin)) {
x -= Tk_X(tkwin) + Tk_Changes(tkwin)->border_width;
y -= Tk_Y(tkwin) + Tk_Changes(tkwin)->border_width;
tkwin = Tk_Parent(tkwin);
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 8033b7b..607af25 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPack.c,v 1.15 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkPack.c,v 1.16 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -1190,7 +1190,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
if (ancestor == parent) {
break;
}
- if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_LEVEL) {
+ if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[0]),
" inside ", Tk_PathName(masterPtr->tkwin),
@@ -1198,7 +1198,7 @@ PackAfter(interp, prevPtr, masterPtr, objc, objv)
return TCL_ERROR;
}
}
- if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL) {
+ if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) {
goto badWindow;
}
if (tkwin == masterPtr->tkwin) {
@@ -1589,7 +1589,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_IsTopLevel(slave)) {
+ if (Tk_TopWinHierarchy(slave)) {
Tcl_AppendResult(interp, "can't pack \"", Tcl_GetString(objv[j]),
"\": it's a top-level window", (char *) NULL);
return TCL_ERROR;
@@ -1795,7 +1795,7 @@ ConfigureSlaves(interp, tkwin, objc, objv)
if (ancestor == parent) {
break;
}
- if (Tk_IsTopLevel(ancestor)) {
+ if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't pack ", Tcl_GetString(objv[j]),
" inside ", Tk_PathName(masterPtr->tkwin),
(char *) NULL);
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 4913b40..9d5e7f5 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPlace.c,v 1.11 2002/01/17 05:13:11 dgp Exp $
+ * RCS: @(#) $Id: tkPlace.c,v 1.12 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -593,7 +593,7 @@ ConfigureSlave(interp, tkwin, table, objc, objv)
int result = TCL_OK;
Slave *slavePtr;
- if (Tk_IsTopLevel(tkwin)) {
+ if (Tk_TopWinHierarchy(tkwin)) {
Tcl_AppendResult(interp, "can't use placer on top-level window \"",
Tk_PathName(tkwin), "\"; use wm command instead",
(char *) NULL);
@@ -626,7 +626,7 @@ ConfigureSlave(interp, tkwin, table, objc, objv)
if (ancestor == Tk_Parent(slavePtr->tkwin)) {
break;
}
- if (Tk_IsTopLevel(ancestor)) {
+ if (Tk_TopWinHierarchy(ancestor)) {
Tcl_AppendResult(interp, "can't place ",
Tk_PathName(slavePtr->tkwin), " relative to ",
Tk_PathName(tkwin), (char *) NULL);
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index c1a971b..0e4edf4 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkPointer.c,v 1.5 2001/11/23 02:07:02 das Exp $
+ * RCS: @(#) $Id: tkPointer.c,v 1.6 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkInt.h"
@@ -562,7 +562,7 @@ UpdateCursor(winPtr)
if (winPtr->atts.cursor != None) {
cursor = winPtr->atts.cursor;
break;
- } else if (winPtr->flags & TK_TOP_LEVEL) {
+ } else if (winPtr->flags & TK_TOP_HIERARCHY) {
break;
}
winPtr = winPtr->parentPtr;
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index c43b8e8..6466f68 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextWind.c,v 1.4 1999/12/14 06:52:33 hobbs Exp $
+ * RCS: @(#) $Id: tkTextWind.c,v 1.5 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tk.h"
@@ -370,7 +370,7 @@ EmbWinConfigure(textPtr, ewPtr, argc, argv)
if (ancestor == parent) {
break;
}
- if (Tk_IsTopLevel(ancestor)) {
+ if (Tk_TopWinHierarchy(ancestor)) {
badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " in ",
@@ -379,7 +379,7 @@ EmbWinConfigure(textPtr, ewPtr, argc, argv)
return TCL_ERROR;
}
}
- if (Tk_IsTopLevel(ewPtr->body.ew.tkwin)
+ if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (ewPtr->body.ew.tkwin == textPtr->tkwin)) {
goto badMaster;
}
@@ -790,7 +790,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
if (ancestor == Tk_Parent(ewPtr->body.ew.tkwin)) {
break;
}
- if (Tk_IsTopLevel(ancestor)) {
+ if (Tk_TopWinHierarchy(ancestor)) {
badMaster:
Tcl_AppendResult(textPtr->interp, "can't embed ",
Tk_PathName(ewPtr->body.ew.tkwin), " relative to ",
@@ -800,7 +800,7 @@ EmbWinLayoutProc(textPtr, indexPtr, ewPtr, offset, maxX, maxChars,
goto gotWindow;
}
}
- if (Tk_IsTopLevel(ewPtr->body.ew.tkwin)
+ if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
goto badMaster;
}
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index aa07b2d..5c1fd17 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.45 2002/04/12 10:20:27 hobbs Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.46 2002/06/14 22:25:12 jenglish Exp $
*/
#include "tkPort.h"
@@ -364,12 +364,12 @@ CreateTopLevelWindow(interp, parent, name, screenName, flags)
winPtr->dirtyAtts |= CWBorderPixel;
/*
- * (Need to set the TK_TOP_LEVEL flag immediately here; otherwise
+ * (Need to set the TK_TOP_HIERARCHY flag immediately here; otherwise
* Tk_DestroyWindow will core dump if it is called before the flag
* has been set.)
*/
- winPtr->flags |= TK_TOP_LEVEL;
+ winPtr->flags |= TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED;
if (parent != NULL) {
if (NameWindow(interp, winPtr, (TkWindow *) parent, name) != TCL_OK) {
@@ -1347,7 +1347,7 @@ Tk_DestroyWindow(tkwin)
* Cleanup the data structures associated with this window.
*/
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_WIN_MANAGED) {
TkWmDeadWindow(winPtr);
} else if (winPtr->flags & TK_WM_COLORMAP_WINDOW) {
TkWmRemoveFromColormapWindows(winPtr);
@@ -1356,7 +1356,7 @@ Tk_DestroyWindow(tkwin)
#if defined(MAC_TCL) || defined(__WIN32__)
XDestroyWindow(winPtr->display, winPtr->window);
#else
- if ((winPtr->flags & TK_TOP_LEVEL)
+ if ((winPtr->flags & TK_TOP_HIERARCHY)
|| !(winPtr->flags & TK_DONT_DESTROY_WINDOW)) {
/*
* The parent has already been destroyed and this isn't
@@ -1538,7 +1538,7 @@ Tk_MapWindow(tkwin)
if (winPtr->window == None) {
Tk_MakeWindowExist(tkwin);
}
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_WIN_MANAGED) {
/*
* Lots of special processing has to be done for top-level
* windows. Let tkWm.c handle everything itself.
@@ -1595,7 +1595,7 @@ Tk_MakeWindowExist(tkwin)
return;
}
- if ((winPtr->parentPtr == NULL) || (winPtr->flags & TK_TOP_LEVEL)) {
+ if ((winPtr->parentPtr == NULL) || (winPtr->flags & TK_TOP_HIERARCHY)) {
parent = XRootWindow(winPtr->display, winPtr->screenNum);
} else {
if (winPtr->parentPtr->window == None) {
@@ -1617,7 +1617,7 @@ Tk_MakeWindowExist(tkwin)
winPtr->dirtyAtts = 0;
winPtr->dirtyChanges = 0;
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
/*
* If any siblings higher up in the stacking order have already
* been created then move this window to its rightful position
@@ -1632,7 +1632,7 @@ Tk_MakeWindowExist(tkwin)
for (winPtr2 = winPtr->nextPtr; winPtr2 != NULL;
winPtr2 = winPtr2->nextPtr) {
if ((winPtr2->window != None)
- && !(winPtr2->flags & (TK_TOP_LEVEL|TK_REPARENTED))) {
+ && !(winPtr2->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))) {
XWindowChanges changes;
changes.sibling = winPtr2->window;
changes.stack_mode = Below;
@@ -1698,7 +1698,7 @@ Tk_UnmapWindow(tkwin)
if (!(winPtr->flags & TK_MAPPED) || (winPtr->flags & TK_ALREADY_DEAD)) {
return;
}
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_WIN_MANAGED) {
/*
* Special processing has to be done for top-level windows. Let
* tkWm.c handle everything itself.
@@ -1709,7 +1709,7 @@ Tk_UnmapWindow(tkwin)
}
winPtr->flags &= ~TK_MAPPED;
XUnmapWindow(winPtr->display, winPtr->window);
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ if (!(winPtr->flags & TK_TOP_HIERARCHY)) {
XEvent event;
event.type = UnmapNotify;
@@ -2018,7 +2018,7 @@ Tk_SetWindowColormap(tkwin, colormap)
if (winPtr->window != None) {
XSetWindowColormap(winPtr->display, winPtr->window, colormap);
- if (!(winPtr->flags & TK_TOP_LEVEL)) {
+ if (!(winPtr->flags & TK_WIN_MANAGED)) {
TkWmAddToColormapWindows(winPtr);
winPtr->flags |= TK_WM_COLORMAP_WINDOW;
}
@@ -2147,7 +2147,7 @@ Tk_SetClass(tkwin, className)
register TkWindow *winPtr = (TkWindow *) tkwin;
winPtr->classUid = Tk_GetUid(className);
- if (winPtr->flags & TK_TOP_LEVEL) {
+ if (winPtr->flags & TK_WIN_MANAGED) {
TkWmSetClass(winPtr);
}
TkOptionClassChanged(winPtr);
@@ -2383,8 +2383,8 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
* otherPtr without changing any of Tk's childLists.
*/
- if (winPtr->flags & TK_TOP_LEVEL) {
- while ((otherPtr != NULL) && !(otherPtr->flags & TK_TOP_LEVEL)) {
+ if (winPtr->flags & TK_WIN_MANAGED) {
+ while ((otherPtr != NULL) && !(otherPtr->flags & TK_TOP_HIERARCHY)) {
otherPtr = otherPtr->parentPtr;
}
TkWmRestackToplevel(winPtr, aboveBelow, otherPtr);
@@ -2410,7 +2410,7 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
}
} else {
while (winPtr->parentPtr != otherPtr->parentPtr) {
- if ((otherPtr == NULL) || (otherPtr->flags & TK_TOP_LEVEL)) {
+ if ((otherPtr == NULL) || (otherPtr->flags & TK_TOP_HIERARCHY)) {
return TCL_ERROR;
}
otherPtr = otherPtr->parentPtr;
@@ -2462,7 +2462,7 @@ Tk_RestackWindow(tkwin, aboveBelow, other)
for (otherPtr = winPtr->nextPtr; otherPtr != NULL;
otherPtr = otherPtr->nextPtr) {
if ((otherPtr->window != None)
- && !(otherPtr->flags & (TK_TOP_LEVEL|TK_REPARENTED))){
+ && !(otherPtr->flags & (TK_TOP_HIERARCHY|TK_REPARENTED))){
changes.sibling = otherPtr->window;
changes.stack_mode = Below;
mask = CWStackMode|CWSibling;