From da386a3666a5114be61a7e7cbfde11dece2cdf97 Mon Sep 17 00:00:00 2001 From: "peter.spjuth@gmail.com" Date: Wed, 26 Sep 2001 20:25:17 +0000 Subject: Geometry manager changes to support TIP#18. --- ChangeLog | 20 +++++++++ doc/GeomReq.3 | 40 +++++++++++++++--- doc/WindowId.3 | 37 +++++++++++++---- generic/tk.decls | 13 +++++- generic/tk.h | 22 ++++++++-- generic/tkDecls.h | 18 +++++++- generic/tkGeometry.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++---- generic/tkGrid.c | 31 +++++++++----- generic/tkInt.h | 20 +++++++-- generic/tkPack.c | 28 +++++++++---- generic/tkPlace.c | 22 ++++++---- generic/tkStubInit.c | 4 +- generic/tkUtil.c | 10 ++--- generic/tkWindow.c | 9 +++- unix/mkLinks | 18 +++++++- 15 files changed, 340 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea75b82..a832123 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2001-09-26 Peter Spjuth + + * doc/GeomReq.3: + * doc/WindowId.3: + * generic/tk.decls: + * generic/tk.h: + * generic/tkDecls.h: + * generic/tkGeometry.c: + * generic/tkGrid.c (ArrangeGrid): + * generic/tkInt.h: + * generic/tkPack.c (ArrangePacking): + * generic/tkPlace.c (RecomputePlacement): + * generic/tkStubInit.c: + * generic/tkUtil.c (TkComputeAnchor): + * generic/tkWindow.c (TkAllocWindow): + * unix/mkLinks: Geometry manager changes to support TIP#18. + Allows a widget to set different internal border widths on + different sides, and to set a minimum requested size. + POTENTIAL INCOMPATIBILITY. [Patch 429164] + 2001-09-25 Don Porter * generic/tkBind.c: diff --git a/doc/GeomReq.3 b/doc/GeomReq.3 index b77ce34..4390d18 100644 --- a/doc/GeomReq.3 +++ b/doc/GeomReq.3 @@ -6,20 +6,24 @@ '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" -'\" RCS: @(#) $Id: GeomReq.3,v 1.2 1998/09/14 18:22:48 stanton Exp $ +'\" RCS: @(#) $Id: GeomReq.3,v 1.3 2001/09/26 20:25:17 pspjuth Exp $ '\" .so man.macros -.TH Tk_GeometryRequest 3 "" Tk "Tk Library Procedures" +.TH Tk_GeometryRequest 3 "8.4" Tk "Tk Library Procedures" .BS .SH NAME -Tk_GeometryRequest, Tk_SetInternalBorder \- specify desired geometry or internal border for a window +Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder, Tk_SetInternalBorderEx \- specify desired geometry or internal border for a window .SH SYNOPSIS .nf \fB#include \fR .sp \fBTk_GeometryRequest\fR(\fItkwin, reqWidth, reqHeight\fR) .sp +\fBTk_SetMinimumRequestSize\fR(\fItkwin, minWidth, minHeight\fR) +.sp \fBTk_SetInternalBorder\fR(\fItkwin, width\fR) +.sp +\fBTk_SetInternalBorderEx\fR(\fItkwin, left, right, top, bottom\fR) .SH ARGUMENTS .AS baseHeight clientData .AP Tk_Window tkwin in @@ -28,8 +32,20 @@ Window for which geometry is being requested. Desired width for \fItkwin\fR, in pixel units. .AP int reqHeight in Desired height for \fItkwin\fR, in pixel units. +.AP int minWidth in +Desired minimum requested width for \fItkwin\fR, in pixel units. +.AP int minHeight in +Desired minimum requested height for \fItkwin\fR, in pixel units. .AP int width in Space to leave for internal border for \fItkwin\fR, in pixel units. +.AP int left in +Space to leave for left side of internal border for \fItkwin\fR, in pixel units. +.AP int right in +Space to leave for right side of internal border for \fItkwin\fR, in pixel units. +.AP int top in +Space to leave for top side of internal border for \fItkwin\fR, in pixel units. +.AP int bottom in +Space to leave for bottom side of internal border for \fItkwin\fR, in pixel units. .BE .SH DESCRIPTION @@ -60,9 +76,21 @@ specifies the width of the border in pixels. Geometry managers will use this information to avoid placing any children of \fItkwin\fR overlapping the outermost \fIwidth\fR pixels of \fItkwin\fR's area. .PP -The information specified in calls to \fBTk_GeometryRequest\fR and -\fBTk_SetInternalBorder\fR can be retrieved using the macros -\fBTk_ReqWidth\fR, \fBTk_ReqHeight\fR, and \fBTk_InternalBorderWidth\fR. +\fBTk_SetInternalBorderEx\fR works like \fBTk_SetInternalBorder\fR +but lets you specify different widths for different sides of the window. +.PP +\fBTk_SetMinimumRequestSize\fR is called by widget code to indicate +that a geometry manager should request at least this size for the +widget. This allows a widget to have some control over its size when +a propagating geometry manager is used inside it. +.PP +The information specified in calls to \fBTk_GeometryRequest\fR, +\fBTk_SetMinimumRequestSize\fR, \fBTk_SetInternalBorder\fR and +\fBTk_SetInternalBorderEx\fR can be retrieved using the macros +\fBTk_ReqWidth\fR, \fBTk_ReqHeight\fR, \fBTk_MinReqWidth\fR, +\fBTk_MinReqHeight\fR, \fBTk_MinReqWidth\fR, \fBTk_InternalBorderLeft\fR, +\fBTk_InternalBorderRight\fR, \fBTk_InternalBorderTop\fR and +\fBTk_InternalBorderBottom\fR. See the \fBTk_WindowId\fR manual entry for details. .SH KEYWORDS diff --git a/doc/WindowId.3 b/doc/WindowId.3 index 533a638..28de341 100644 --- a/doc/WindowId.3 +++ b/doc/WindowId.3 @@ -5,13 +5,13 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: WindowId.3,v 1.5 2000/01/21 03:54:20 hobbs Exp $ +'\" RCS: @(#) $Id: WindowId.3,v 1.6 2001/09/26 20:25:17 pspjuth Exp $ '\" .so man.macros -.TH Tk_WindowId 3 "" Tk "Tk Library Procedures" +.TH Tk_WindowId 3 "8.4" Tk "Tk Library Procedures" .BS .SH NAME -Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_InternalBorderWidth, Tk_Visual, Tk_Depth, Tk_Colormap \- retrieve information from Tk's local data structure +Tk_WindowId, Tk_Parent, Tk_Display, Tk_DisplayName, Tk_ScreenNumber, Tk_Screen, Tk_X, Tk_Y, Tk_Width, Tk_Height, Tk_Changes, Tk_Attributes, Tk_IsContainer, Tk_IsEmbedded, Tk_IsMapped, Tk_IsTopLevel, Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop, Tk_InternalBorderBottom, Tk_Visual, Tk_Depth, Tk_Colormap \- retrieve information from Tk's local data structure .SH SYNOPSIS .nf \fB#include \fR @@ -71,7 +71,22 @@ int \fBTk_ReqHeight\fR(\fItkwin\fR) .sp int -\fBTk_InternalBorderWidth\fR(\fItkwin\fR) +\fBTk_MinReqWidth\fR(\fItkwin\fR) +.sp +int +\fBTk_MinReqHeight\fR(\fItkwin\fR) +.sp +int +\fBTk_InternalBorderLeft\fR(\fItkwin\fR) +.sp +int +\fBTk_InternalBorderRight\fR(\fItkwin\fR) +.sp +int +\fBTk_InternalBorderTop\fR(\fItkwin\fR) +.sp +int +\fBTk_InternalBorderBottom\fR(\fItkwin\fR) .sp Visual * \fBTk_Visual\fR(\fItkwin\fR) @@ -145,10 +160,16 @@ screen) and zero if \fItkwin\fR isn't a top-level window. the window's requested size. These values correspond to the last call to \fBTk_GeometryRequest\fR for \fItkwin\fR. .PP -\fBTk_InternalBorderWidth\fR returns the width of internal border -that has been requested for \fItkwin\fR, or 0 if no internal border -was requested. The return value is simply the last value passed -to \fBTk_SetInternalBorder\fR for \fItkwin\fR. +\fBTk_MinReqWidth\fR and \fBTk_MinReqHeight\fR return information about +the window's minimum requested size. These values correspond to the last +call to \fBTk_SetMinimumRequestSize\fR for \fItkwin\fR. +.PP +\fBTk_InternalBorderLeft\fR, \fBTk_InternalBorderRight\fR, +\fBTk_InternalBorderTop\fR and \fBTk_InternalBorderBottom\fR +return the width of one side of the internal border +that has been requested for \fItkwin\fR, or 0 if no internal border was +requested. The return value is simply the last value passed to +\fBTk_SetInternalBorder\fR or \fBTk_SetInternalBorderEx\fR for \fItkwin\fR. .PP \fBTk_Visual\fR, \fBTk_Depth\fR, and \fBTk_Colormap\fR return information about the visual characteristics of a window. diff --git a/generic/tk.decls b/generic/tk.decls index d9b4a32..3d99766 100644 --- a/generic/tk.decls +++ b/generic/tk.decls @@ -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: tk.decls,v 1.14 2000/11/22 01:49:37 ericm Exp $ +# RCS: @(#) $Id: tk.decls,v 1.15 2001/09/26 20:25:17 pspjuth Exp $ library tk @@ -1147,6 +1147,17 @@ declare 242 generic { Tk_ClassProcs *procs, ClientData instanceData) } +# New in 8.4a4 +# +declare 243 generic { + void Tk_SetInternalBorderEx (Tk_Window tkwin, int left, int right, \ + int top, int bottom) +} +declare 244 generic { + void Tk_SetMinimumRequestSize (Tk_Window tkwin, \ + int minWidth, int minHeight) +} + # Define the platform specific public Tk interface. These functions are # only available on the designated platform. diff --git a/generic/tk.h b/generic/tk.h index 0751507..9903342 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.56 2001/08/08 18:41:10 dgp Exp $ + * RCS: @(#) $Id: tk.h,v 1.57 2001/09/26 20:25:17 pspjuth Exp $ */ #ifndef _TK @@ -717,8 +717,19 @@ typedef XActivateDeactivateEvent XDeactivateEvent; (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_LEVEL) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) +/* Tk_InternalBorderWidth is deprecated */ #define Tk_InternalBorderWidth(tkwin) \ - (((Tk_FakeWin *) (tkwin))->internalBorderWidth) + (((Tk_FakeWin *) (tkwin))->internalBorderLeft) +#define Tk_InternalBorderLeft(tkwin) \ + (((Tk_FakeWin *) (tkwin))->internalBorderLeft) +#define Tk_InternalBorderRight(tkwin) \ + (((Tk_FakeWin *) (tkwin))->internalBorderRight) +#define Tk_InternalBorderTop(tkwin) \ + (((Tk_FakeWin *) (tkwin))->internalBorderTop) +#define Tk_InternalBorderBottom(tkwin) \ + (((Tk_FakeWin *) (tkwin))->internalBorderBottom) +#define Tk_MinReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->minReqWidth) +#define Tk_MinReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->minReqHeight) #define Tk_Parent(tkwin) (((Tk_FakeWin *) (tkwin))->parentPtr) #define Tk_Colormap(tkwin) (((Tk_FakeWin *) (tkwin))->atts.colormap) @@ -764,11 +775,16 @@ typedef struct Tk_FakeWin { char *dummy14; /* geomMgrPtr */ ClientData dummy15; /* geomData */ int reqWidth, reqHeight; - int internalBorderWidth; + int internalBorderLeft; char *dummy16; /* wmInfoPtr */ char *dummy17; /* classProcPtr */ ClientData dummy18; /* instanceData */ char *dummy19; /* privatePtr */ + int internalBorderRight; + int internalBorderTop; + int internalBorderBottom; + int minReqWidth; + int minReqHeight; } Tk_FakeWin; /* diff --git a/generic/tkDecls.h b/generic/tkDecls.h index e4753e1..a60433b 100644 --- a/generic/tkDecls.h +++ b/generic/tkDecls.h @@ -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: tkDecls.h,v 1.14 2000/11/22 01:49:37 ericm Exp $ + * RCS: @(#) $Id: tkDecls.h,v 1.15 2001/09/26 20:25:17 pspjuth Exp $ */ #ifndef _TKDECLS @@ -834,6 +834,12 @@ EXTERN Tk_Window Tk_CreateAnonymousWindow _ANSI_ARGS_(( EXTERN void Tk_SetClassProcs _ANSI_ARGS_((Tk_Window tkwin, Tk_ClassProcs * procs, ClientData instanceData)); +/* 243 */ +EXTERN void Tk_SetInternalBorderEx _ANSI_ARGS_((Tk_Window tkwin, + int left, int right, int top, int bottom)); +/* 244 */ +EXTERN void Tk_SetMinimumRequestSize _ANSI_ARGS_(( + Tk_Window tkwin, int minWidth, int minHeight)); typedef struct TkStubHooks { struct TkPlatStubs *tkPlatStubs; @@ -1089,6 +1095,8 @@ typedef struct TkStubs { void (*tk_DeleteClientMessageHandler) _ANSI_ARGS_((Tk_ClientMessageProc * proc)); /* 240 */ Tk_Window (*tk_CreateAnonymousWindow) _ANSI_ARGS_((Tcl_Interp * interp, Tk_Window parent, char * screenName)); /* 241 */ void (*tk_SetClassProcs) _ANSI_ARGS_((Tk_Window tkwin, Tk_ClassProcs * procs, ClientData instanceData)); /* 242 */ + void (*tk_SetInternalBorderEx) _ANSI_ARGS_((Tk_Window tkwin, int left, int right, int top, int bottom)); /* 243 */ + void (*tk_SetMinimumRequestSize) _ANSI_ARGS_((Tk_Window tkwin, int minWidth, int minHeight)); /* 244 */ } TkStubs; #ifdef __cplusplus @@ -2071,6 +2079,14 @@ extern TkStubs *tkStubsPtr; #define Tk_SetClassProcs \ (tkStubsPtr->tk_SetClassProcs) /* 242 */ #endif +#ifndef Tk_SetInternalBorderEx +#define Tk_SetInternalBorderEx \ + (tkStubsPtr->tk_SetInternalBorderEx) /* 243 */ +#endif +#ifndef Tk_SetMinimumRequestSize +#define Tk_SetMinimumRequestSize \ + (tkStubsPtr->tk_SetMinimumRequestSize) /* 244 */ +#endif #endif /* defined(USE_TK_STUBS) && !defined(USE_TK_STUB_PROCS) */ diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index dd8de2e..f2b1ffa 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.4 2000/10/05 00:50:00 ericm Exp $ + * RCS: @(#) $Id: tkGeometry.c,v 1.5 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkPort.h" @@ -165,6 +165,79 @@ Tk_GeometryRequest(tkwin, reqWidth, reqHeight) /* *---------------------------------------------------------------------- * + * Tk_SetInternalBorderEx -- + * + * Notify relevant geometry managers that a window has an internal + * border of a given width and that child windows should not be + * placed on that border. + * + * Results: + * None. + * + * Side effects: + * The border widths are recorded for the window, and all geometry + * managers of all children are notified so that can re-layout, if + * necessary. + * + *---------------------------------------------------------------------- + */ + +void +Tk_SetInternalBorderEx(tkwin, left, right, top, bottom) + Tk_Window tkwin; /* Window that will have internal border. */ + int left, right; /* Width of internal border, in pixels. */ + int top, bottom; +{ + register TkWindow *winPtr = (TkWindow *) tkwin; + register int changed = 0; + + if (left < 0) { + left = 0; + } + if (left != winPtr->internalBorderLeft) { + winPtr->internalBorderLeft = left; + changed = 1; + } + + if (right < 0) { + right = 0; + } + if (right != winPtr->internalBorderRight) { + winPtr->internalBorderRight = right; + changed = 1; + } + + if (top < 0) { + top = 0; + } + if (top != winPtr->internalBorderTop) { + winPtr->internalBorderTop = top; + changed = 1; + } + + if (bottom < 0) { + bottom = 0; + } + if (bottom != winPtr->internalBorderBottom) { + winPtr->internalBorderBottom = bottom; + changed = 1; + } + + /* + * All the slaves for which this is the master window must now be + * repositioned to take account of the new internal border width. + * To signal all the geometry managers to do this, just resize the + * window to its current size. The ConfigureNotify event will + * cause geometry managers to recompute everything. + */ + + if (changed) { + Tk_ResizeWindow(tkwin, Tk_Width(tkwin), Tk_Height(tkwin)); + } +} +/* + *---------------------------------------------------------------------- + * * Tk_SetInternalBorder -- * * Notify relevant geometry managers that a window has an internal @@ -187,19 +260,45 @@ Tk_SetInternalBorder(tkwin, width) Tk_Window tkwin; /* Window that will have internal border. */ int width; /* Width of internal border, in pixels. */ { + Tk_SetInternalBorderEx(tkwin, width, width, width, width); +} + +/* + *---------------------------------------------------------------------- + * + * Tk_SetMinimumRequestSize -- + * + * Notify relevant geometry managers that a window has a minimum + * request size. + * + * Results: + * None. + * + * Side effects: + * The minimum request size is recorded for the window, and + * a new size is requested for the window, if necessary. + * + *---------------------------------------------------------------------- + */ + +void +Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight) + Tk_Window tkwin; /* Window that will have internal border. */ + int minWidth, minHeight; /* Minimum requested size, in pixels. */ +{ register TkWindow *winPtr = (TkWindow *) tkwin; - if (width == winPtr->internalBorderWidth) { + if ((winPtr->minReqWidth == minWidth) && + (winPtr->minReqHeight == minHeight)) { return; } - if (width < 0) { - width = 0; - } - winPtr->internalBorderWidth = width; + + winPtr->minReqWidth = minWidth; + winPtr->minReqHeight = minHeight; /* - * All the slaves for which this is the master window must now be - * repositioned to take account of the new internal border width. + * The changed min size may cause geometry managers to get a + * different result, so make them recompute. * To signal all the geometry managers to do this, just resize the * window to its current size. The ConfigureNotify event will * cause geometry managers to recompute everything. diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 28c872e..6737e0a 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.15 2001/09/17 23:16:26 dgp Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.16 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkInt.h" @@ -1487,13 +1487,22 @@ ArrangeGrid(clientData) SetGridSize(masterPtr); width = ResolveConstraints(masterPtr, COLUMN, 0); height = ResolveConstraints(masterPtr, ROW, 0); - width += 2*Tk_InternalBorderWidth(masterPtr->tkwin); - height += 2*Tk_InternalBorderWidth(masterPtr->tkwin); + width += Tk_InternalBorderLeft(masterPtr->tkwin) + + Tk_InternalBorderRight(masterPtr->tkwin); + height += Tk_InternalBorderTop(masterPtr->tkwin) + + Tk_InternalBorderBottom(masterPtr->tkwin); + + if (width < Tk_MinReqWidth(masterPtr->tkwin)) { + width = Tk_MinReqWidth(masterPtr->tkwin); + } + if (height < Tk_MinReqHeight(masterPtr->tkwin)) { + height = Tk_MinReqHeight(masterPtr->tkwin); + } if (((width != Tk_ReqWidth(masterPtr->tkwin)) - || (height != Tk_ReqHeight(masterPtr->tkwin))) - && !(masterPtr->flags & DONT_PROPAGATE)) { - Tk_GeometryRequest(masterPtr->tkwin, width, height); + || (height != Tk_ReqHeight(masterPtr->tkwin))) + && !(masterPtr->flags & DONT_PROPAGATE)) { + Tk_GeometryRequest(masterPtr->tkwin, width, height); if (width>1 && height>1) { masterPtr->flags |= REQUESTED_RELAYOUT; Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); @@ -1512,15 +1521,17 @@ ArrangeGrid(clientData) */ realWidth = Tk_Width(masterPtr->tkwin) - - 2*Tk_InternalBorderWidth(masterPtr->tkwin); + Tk_InternalBorderLeft(masterPtr->tkwin) - + Tk_InternalBorderRight(masterPtr->tkwin); realHeight = Tk_Height(masterPtr->tkwin) - - 2*Tk_InternalBorderWidth(masterPtr->tkwin); + Tk_InternalBorderTop(masterPtr->tkwin) - + Tk_InternalBorderBottom(masterPtr->tkwin); slotPtr->startX = AdjustOffsets(realWidth, MAX(slotPtr->columnEnd,slotPtr->columnMax), slotPtr->columnPtr); slotPtr->startY = AdjustOffsets(realHeight, MAX(slotPtr->rowEnd,slotPtr->rowMax), slotPtr->rowPtr); - slotPtr->startX += Tk_InternalBorderWidth(masterPtr->tkwin); - slotPtr->startY += Tk_InternalBorderWidth(masterPtr->tkwin); + slotPtr->startX += Tk_InternalBorderLeft(masterPtr->tkwin); + slotPtr->startY += Tk_InternalBorderTop(masterPtr->tkwin); /* * Now adjust the actual size of the slave to its cavity by diff --git a/generic/tkInt.h b/generic/tkInt.h index 0142200..ce68146 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -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: tkInt.h,v 1.38 2001/08/21 20:21:36 pspjuth Exp $ + * RCS: $Id: tkInt.h,v 1.39 2001/09/26 20:25:17 pspjuth Exp $ */ #ifndef _TKINT @@ -743,10 +743,12 @@ typedef struct TkWindow { * Tk_GeometryRequest, or 0's if * Tk_GeometryRequest hasn't been * called. */ - int internalBorderWidth; /* Width of internal border of window + int internalBorderLeft; /* Width of internal border of window * (0 means no internal border). Geometry * managers should not normally place children - * on top of the border. */ + * on top of the border. + * Fields for the other three sides are found + * below. */ /* * Information maintained by tkWm.c for window manager communication. @@ -770,6 +772,18 @@ typedef struct TkWindow { */ struct TkWindowPrivate *privatePtr; + + /* + * More information used by tkGeometry.c for geometry management. + */ + + /* The remaining fields of internal border. */ + int internalBorderRight; + int internalBorderTop; + int internalBorderBottom; + + int minReqWidth; /* Minimum requested width. */ + int minReqHeight; /* Minimum requested height. */ } TkWindow; /* diff --git a/generic/tkPack.c b/generic/tkPack.c index 5ec3496..106b547 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.12 2001/09/23 11:30:44 pspjuth Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.13 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkPort.h" @@ -556,8 +556,6 @@ ArrangePacking(clientData) * allocated to the current window. */ int x, y, width, height; /* These variables are used to hold the * actual geometry of the current window. */ - int intBWidth; /* Width of internal border in parent window, - * if any. */ int abort; /* May get set to non-zero to abort this * repacking operation. */ int borderX, borderY; @@ -609,8 +607,10 @@ ArrangePacking(clientData) * maxHeight - Same as maxWidth, except keeps height info. */ - intBWidth = Tk_InternalBorderWidth(masterPtr->tkwin); - width = height = maxWidth = maxHeight = 2*intBWidth; + width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) + + Tk_InternalBorderRight(masterPtr->tkwin); + height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) + + Tk_InternalBorderBottom(masterPtr->tkwin); for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { @@ -638,6 +638,13 @@ ArrangePacking(clientData) maxHeight = height; } + if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) { + maxWidth = Tk_MinReqWidth(masterPtr->tkwin); + } + if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) { + maxHeight = Tk_MinReqHeight(masterPtr->tkwin); + } + /* * If the total amount of space needed in the parent window has * changed, and if we're propagating geometry information, then @@ -666,9 +673,14 @@ ArrangePacking(clientData) * frame, depending on anchor. */ - cavityX = cavityY = x = y = intBWidth; - cavityWidth = Tk_Width(masterPtr->tkwin) - 2*intBWidth; - cavityHeight = Tk_Height(masterPtr->tkwin) - 2*intBWidth; + cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin); + cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin); + cavityWidth = Tk_Width(masterPtr->tkwin) - + Tk_InternalBorderLeft(masterPtr->tkwin) - + Tk_InternalBorderRight(masterPtr->tkwin); + cavityHeight = Tk_Height(masterPtr->tkwin) - + Tk_InternalBorderTop(masterPtr->tkwin) - + Tk_InternalBorderBottom(masterPtr->tkwin); for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) { diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 23cd783..746581a 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.9 2001/08/29 23:22:24 hobbs Exp $ + * RCS: @(#) $Id: tkPlace.c,v 1.10 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkPort.h" @@ -810,7 +810,7 @@ RecomputePlacement(clientData) register Master *masterPtr = (Master *) clientData; register Slave *slavePtr; int x, y, width, height, tmp; - int masterWidth, masterHeight, masterBW; + int masterWidth, masterHeight, masterX, masterY; double x1, y1, x2, y2; masterPtr->flags &= ~PARENT_RECONFIG_PENDING; @@ -827,25 +827,29 @@ RecomputePlacement(clientData) * account desired border mode. */ - masterBW = 0; + masterX = masterY = 0; masterWidth = Tk_Width(masterPtr->tkwin); masterHeight = Tk_Height(masterPtr->tkwin); if (slavePtr->borderMode == BM_INSIDE) { - masterBW = Tk_InternalBorderWidth(masterPtr->tkwin); + masterX = Tk_InternalBorderLeft(masterPtr->tkwin); + masterY = Tk_InternalBorderTop(masterPtr->tkwin); + masterWidth -= masterX + Tk_InternalBorderRight(masterPtr->tkwin); + masterHeight -= masterY + + Tk_InternalBorderBottom(masterPtr->tkwin); } else if (slavePtr->borderMode == BM_OUTSIDE) { - masterBW = -Tk_Changes(masterPtr->tkwin)->border_width; + masterX = masterY = -Tk_Changes(masterPtr->tkwin)->border_width; + masterWidth -= 2 * masterX; + masterHeight -= 2 * masterY; } - masterWidth -= 2*masterBW; - masterHeight -= 2*masterBW; /* * Step 2: compute size of slave (outside dimensions including * border) and location of anchor point within master. */ - x1 = slavePtr->x + masterBW + (slavePtr->relX*masterWidth); + x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth); x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5)); - y1 = slavePtr->y + masterBW + (slavePtr->relY*masterHeight); + y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight); y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5)); if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) { width = 0; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index bbf3506..9710089 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.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: tkStubInit.c,v 1.27 2001/09/25 16:25:20 dgp Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.28 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkInt.h" @@ -955,6 +955,8 @@ TkStubs tkStubs = { Tk_DeleteClientMessageHandler, /* 240 */ Tk_CreateAnonymousWindow, /* 241 */ Tk_SetClassProcs, /* 242 */ + Tk_SetInternalBorderEx, /* 243 */ + Tk_SetMinimumRequestSize, /* 244 */ }; /* !END!: Do not edit above this line. */ diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 80f9919..8cde5a9 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.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: tkUtil.c,v 1.10 2001/08/15 15:44:36 dkf Exp $ + * RCS: @(#) $Id: tkUtil.c,v 1.11 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkInt.h" @@ -794,7 +794,7 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr) case TK_ANCHOR_NW: case TK_ANCHOR_W: case TK_ANCHOR_SW: - *xPtr = Tk_InternalBorderWidth(tkwin) + padX; + *xPtr = Tk_InternalBorderLeft(tkwin) + padX; break; case TK_ANCHOR_N: @@ -804,7 +804,7 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr) break; default: - *xPtr = Tk_Width(tkwin) - (Tk_InternalBorderWidth(tkwin) + padX) + *xPtr = Tk_Width(tkwin) - (Tk_InternalBorderRight(tkwin) + padX) - innerWidth; break; } @@ -813,7 +813,7 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr) case TK_ANCHOR_NW: case TK_ANCHOR_N: case TK_ANCHOR_NE: - *yPtr = Tk_InternalBorderWidth(tkwin) + padY; + *yPtr = Tk_InternalBorderTop(tkwin) + padY; break; case TK_ANCHOR_W: @@ -823,7 +823,7 @@ TkComputeAnchor(anchor, tkwin, padX, padY, innerWidth, innerHeight, xPtr, yPtr) break; default: - *yPtr = Tk_Height(tkwin) - Tk_InternalBorderWidth(tkwin) - padY + *yPtr = Tk_Height(tkwin) - Tk_InternalBorderBottom(tkwin) - padY - innerHeight; break; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 4316f31..c4d7ab4 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.37 2001/09/21 22:08:19 hobbs Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.38 2001/09/26 20:25:17 pspjuth Exp $ */ #include "tkPort.h" @@ -649,11 +649,16 @@ TkAllocWindow(dispPtr, screenNum, parentPtr) winPtr->geomMgrPtr = NULL; winPtr->geomData = NULL; winPtr->reqWidth = winPtr->reqHeight = 1; - winPtr->internalBorderWidth = 0; + winPtr->internalBorderLeft = 0; winPtr->wmInfoPtr = NULL; winPtr->classProcsPtr = NULL; winPtr->instanceData = NULL; winPtr->privatePtr = NULL; + winPtr->internalBorderRight = 0; + winPtr->internalBorderTop = 0; + winPtr->internalBorderBottom = 0; + winPtr->minReqWidth = 0; + winPtr->minReqHeight = 0; return winPtr; } diff --git a/unix/mkLinks b/unix/mkLinks index 9e9079d..47f0d86 100644 --- a/unix/mkLinks +++ b/unix/mkLinks @@ -268,9 +268,13 @@ if test -r FreeXId.3; then fi if test -r GeomReq.3; then rm -f Tk_GeometryRequest.3 + rm -f Tk_SetMinimumRequestSize.3 rm -f Tk_SetInternalBorder.3 + rm -f Tk_SetInternalBorderEx.3 ln GeomReq.3 Tk_GeometryRequest.3 + ln GeomReq.3 Tk_SetMinimumRequestSize.3 ln GeomReq.3 Tk_SetInternalBorder.3 + ln GeomReq.3 Tk_SetInternalBorderEx.3 fi if test -r GetAnchor.3; then rm -f Tk_GetAnchorFromObj.3 @@ -651,9 +655,14 @@ if test -r WindowId.3; then rm -f Tk_IsEmbedded.3 rm -f Tk_IsMapped.3 rm -f Tk_IsTopLevel.3 + rm -f Tk_MinReqWidth.3 + rm -f Tk_MinReqHeight.3 rm -f Tk_ReqWidth.3 rm -f Tk_ReqHeight.3 - rm -f Tk_InternalBorderWidth.3 + rm -f Tk_InternalBorderLeft.3 + rm -f Tk_InternalBorderRight.3 + rm -f Tk_InternalBorderTop.3 + rm -f Tk_InternalBorderBottom.3 rm -f Tk_Visual.3 rm -f Tk_Depth.3 rm -f Tk_Colormap.3 @@ -673,9 +682,14 @@ if test -r WindowId.3; then ln WindowId.3 Tk_IsEmbedded.3 ln WindowId.3 Tk_IsMapped.3 ln WindowId.3 Tk_IsTopLevel.3 + ln WindowId.3 Tk_MinReqWidth.3 + ln WindowId.3 Tk_MinReqHeight.3 ln WindowId.3 Tk_ReqWidth.3 ln WindowId.3 Tk_ReqHeight.3 - ln WindowId.3 Tk_InternalBorderWidth.3 + ln WindowId.3 Tk_InternalBorderLeft.3 + ln WindowId.3 Tk_InternalBorderRight.3 + ln WindowId.3 Tk_InternalBorderTop.3 + ln WindowId.3 Tk_InternalBorderBottom.3 ln WindowId.3 Tk_Visual.3 ln WindowId.3 Tk_Depth.3 ln WindowId.3 Tk_Colormap.3 -- cgit v0.12