summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorericm <ericm>2000-10-05 00:49:59 (GMT)
committerericm <ericm>2000-10-05 00:49:59 (GMT)
commit3c249a7000fb9bacdda68774c89048bccb81d87a (patch)
tree71d71aa44934d02476d9b35d8b344960884591ea
parent6a7f0098d0e0b2d543fe7f7321e5b996fa009d93 (diff)
downloadtk-3c249a7000fb9bacdda68774c89048bccb81d87a.zip
tk-3c249a7000fb9bacdda68774c89048bccb81d87a.tar.gz
tk-3c249a7000fb9bacdda68774c89048bccb81d87a.tar.bz2
* doc/MaintGeom.3: Noted that Tk_MaintainGeometry handles direct
descendants properly. * generic/tkGeometry.c (Tk_MaintainGeometry): Added a check for the case in which the slave window is a direct descendant of the master window. In this case, we need not set up the additional infrastructure normally provide by Tk_MaintainGeometry, because we can rely on the parent/child relationship to handle it for us implicitly. In this case, Tk_MaintainGeometry just calls directly to Tk_MoveResizeWindow. This allows geometry managers to simply always use Tk_MaintainGeometry to maintain geometry for slaves, and avoid doing the direct descendant check themselves. (Tk_UnmaintainGeometry): Added a matching check for the direct descendant case; in this case, Tk_UnmaintainGeometry simply returns immediately.
-rw-r--r--ChangeLog18
-rw-r--r--doc/MaintGeom.35
-rw-r--r--generic/tkGeometry.c31
3 files changed, 51 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 70ebbae..cd74a31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2000-10-04 Eric Melski <ericm@ajubasolutions.com>
+
+ * doc/MaintGeom.3: Noted that Tk_MaintainGeometry handles direct
+ descendants properly.
+
+ * generic/tkGeometry.c (Tk_MaintainGeometry): Added a check for
+ the case in which the slave window is a direct descendant of the
+ master window. In this case, we need not set up the additional
+ infrastructure normally provide by Tk_MaintainGeometry, because we
+ can rely on the parent/child relationship to handle it for us
+ implicitly. In this case, Tk_MaintainGeometry just calls directly
+ to Tk_MoveResizeWindow. This allows geometry managers to simply
+ always use Tk_MaintainGeometry to maintain geometry for slaves,
+ and avoid doing the direct descendant check themselves.
+ (Tk_UnmaintainGeometry): Added a matching check for the direct
+ descendant case; in this case, Tk_UnmaintainGeometry simply
+ returns immediately.
+
2000-10-01 Eric Melski <ericm@ajubasolutions.com>
* generic/tkButton.c (ConfigureButton): Added tests for -compound
diff --git a/doc/MaintGeom.3 b/doc/MaintGeom.3
index b9f882d..4f59c0e 100644
--- a/doc/MaintGeom.3
+++ b/doc/MaintGeom.3
@@ -5,7 +5,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: MaintGeom.3,v 1.2 1998/09/14 18:22:52 stanton Exp $
+'\" RCS: @(#) $Id: MaintGeom.3,v 1.3 2000/10/05 00:50:00 ericm Exp $
'\"
.so man.macros
.TH Tk_MaintainGeometry 3 4.0 Tk "Tk Library Procedures"
@@ -64,7 +64,8 @@ is unmapped, the slave is automatically removed by the screen
by X.
.PP
\fBTk_MaintainGeometry\fR deals with these problems for slaves
-whose masters aren't their parents.
+whose masters aren't their parents, as well as handling the simpler
+case of slaves whose masters are their parents.
\fBTk_MaintainGeometry\fR is typically called by a window manager
once it has decided where a slave should be positioned relative
to its master.
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 1851965..dd8de2e 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.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: tkGeometry.c,v 1.3 1999/04/16 01:51:14 stanton Exp $
+ * RCS: @(#) $Id: tkGeometry.c,v 1.4 2000/10/05 00:50:00 ericm Exp $
*/
#include "tkPort.h"
@@ -250,6 +250,26 @@ Tk_MaintainGeometry(slave, master, x, y, width, height)
Tk_Window ancestor, parent;
TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
+ if (master == Tk_Parent(slave)) {
+ /*
+ * If the slave is a direct descendant of the master, don't bother
+ * setting up the extra infrastructure for management, just make a
+ * call to Tk_MoveResizeWindow; the parent/child relationship will
+ * take care of the rest.
+ */
+ Tk_MoveResizeWindow(slave, x, y, width, height);
+
+ /*
+ * Map the slave if the master is already mapped; otherwise, wait
+ * until the master is mapped later (in which case mapping the slave
+ * is taken care of elsewhere).
+ */
+ if (Tk_IsMapped(master)) {
+ Tk_MapWindow(slave);
+ }
+ return;
+ }
+
if (!dispPtr->geomInit) {
dispPtr->geomInit = 1;
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);
@@ -374,6 +394,15 @@ Tk_UnmaintainGeometry(slave, master)
Tk_Window ancestor;
TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr;
+ if (master == Tk_Parent(slave)) {
+ /*
+ * If the slave is a direct descendant of the master,
+ * Tk_MaintainGeometry will not have set up any of the extra
+ * infrastructure. Don't even bother to look for it, just return.
+ */
+ return;
+ }
+
if (!dispPtr->geomInit) {
dispPtr->geomInit = 1;
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);