From 1667a2086cbfd55fcb18647800fdf218e39a1989 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Oct 2024 13:39:19 +0000 Subject: [PATCH 01/19] Make a start on [29ba539501] for PanedWindow --- generic/tkPanedWindow.c | 190 +++++++++++++++++++++++----------------- 1 file changed, 112 insertions(+), 78 deletions(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index aab335e98..3dfcc0101 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -89,8 +89,6 @@ typedef struct Pane { Tcl_Obj *widthObj, *heightObj; /* Tcl_Obj rep's of pane width/height, to * allow for null values. */ - int width; /* Pane width. */ - int height; /* Pane height. */ int sticky; /* Sticky string. */ int x, y; /* Coordinates of the widget. */ int paneWidth, paneHeight; /* Pane dimensions (may be different from @@ -107,8 +105,8 @@ typedef struct Pane { Tk_Window after; /* Placeholder for parsing options. */ Tk_Window before; /* Placeholder for parsing options. */ #ifdef BUILD_tk - int padX, padY; - int minSize; + int width; /* Pane width. */ + int height; /* Pane height. */ #endif } Pane; @@ -127,7 +125,7 @@ typedef struct PanedWindow { * specifications. */ Tk_OptionTable paneOpts; /* Token for pane cget table. */ Tk_3DBorder background; /* Background color. */ - int borderWidth; /* Value of -borderwidth option. */ + Tcl_Obj *borderWidthObj; int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */ Tcl_Obj *widthObj; /* Tcl_Obj rep for width. */ Tcl_Obj *heightObj; /* Tcl_Obj rep for height. */ @@ -137,30 +135,30 @@ typedef struct PanedWindow { int resizeOpaque; /* Boolean indicating whether resize should be * opaque or rubberband style. */ int sashRelief; /* Relief used to draw sash. */ - int sashWidth; /* Width of each sash, in pixels. */ - Tcl_Obj *sashWidthPtr; /* Tcl_Obj rep for sash width. */ - int sashPad; /* Additional padding around each sash. */ - Tcl_Obj *sashPadPtr; /* Tcl_Obj rep for sash padding. */ + Tcl_Obj *sashWidthObj; /* Tcl_Obj rep for sash width. */ + Tcl_Obj *sashPadObj; /* Tcl_Obj rep for sash padding. */ int showHandle; /* Boolean indicating whether sash handles * should be drawn. */ - int handleSize; /* Size of one side of a sash handle (handles - * are square), in pixels. */ int handlePad; /* Distance from border to draw handle. */ - Tcl_Obj *handleSizePtr; /* Tcl_Obj rep for handle size. */ + Tcl_Obj *handleSizeObj; /* Tcl_Obj rep for handle size. */ Tk_Cursor sashCursor; /* Cursor used when mouse is above a sash. */ GC gc; /* Graphics context for copying from * off-screen pixmap onto screen. */ int proxyx, proxyy; /* Proxy x,y coordinates. */ Tk_3DBorder proxyBackground;/* Background color used to draw proxy. If NULL, use background. */ - Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */ - int proxyBorderWidth; /* Borderwidth used to draw proxy. */ + Tcl_Obj *proxyBorderWidthObj; /* Tcl_Obj rep for proxyBorderWidth */ int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */ Pane **panes; /* Pointer to array of Panes. */ int numPanes; /* Number of panes. */ int sizeofPanes; /* Number of elements in the panes array. */ int flags; /* Flags for widget; see below. */ - Tcl_Obj *borderWidthObj; - Tcl_Obj *handlePadPtr; + Tcl_Obj *handlePadObj; +#ifdef BUILD_tk + int borderWidth; /* Value of -borderwidth option. */ + int sashWidth; /* Width of each sash, in pixels. */ + int sashPad; /* Additional padding around each sash. */ + int proxyBorderWidth; /* Borderwidth used to draw proxy. */ +#endif } PanedWindow; /* @@ -291,11 +289,11 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", - DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadPtr), offsetof(PanedWindow, handlePad), + DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadObj), offsetof(PanedWindow, handlePad), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", - DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr), - offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY}, + DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizeObj), + TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightObj), offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, @@ -309,7 +307,7 @@ static const Tk_OptionSpec optionSpecs[] = { 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK, (void *)DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth", - DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr), + DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthObj), offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief", 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief), @@ -320,13 +318,13 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", - DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadPtr), offsetof(PanedWindow, sashPad), + DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadObj), offsetof(PanedWindow, sashPad), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief), 0, 0, 0}, {TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width", - DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr), + DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthObj), offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle", DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle), @@ -350,11 +348,11 @@ static const Tk_OptionSpec paneOptionSpecs[] = { {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, - DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), offsetof(Pane, minSize), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_MINSIZE, offsetof(Pane, minSizeObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), offsetof(Pane, padX), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADX, offsetof(Pane, padXObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, - DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), offsetof(Pane, padY), 0, 0, 0}, + DEF_PANEDWINDOW_PANE_PADY, offsetof(Pane, padYObj), TCL_INDEX_NONE, 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0, &stickyOption, 0}, @@ -927,11 +925,15 @@ ConfigurePanes( found = 0; for (j = 0; j < pwPtr->numPanes; j++) { if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) { + int minSize; Tk_SetOptions(interp, pwPtr->panes[j], pwPtr->paneOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); - if (pwPtr->panes[j]->minSize < 0) { - pwPtr->panes[j]->minSize = 0; + Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->panes[j]->minSizeObj, &minSize); + if (minSize < 0) { + Tcl_DecrRefCount(pwPtr->panes[j]->minSizeObj); + pwPtr->panes[j]->minSizeObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(pwPtr->panes[j]->minSizeObj); } found = 1; @@ -971,6 +973,7 @@ ConfigurePanes( * Create a new pane structure and initialize it. All panes start * out with their "natural" dimensions. */ + int minSize; panePtr = (Pane *)ckalloc(sizeof(Pane)); memset(panePtr, 0, sizeof(Pane)); @@ -992,8 +995,11 @@ ConfigurePanes( } else { panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw; } - if (panePtr->minSize < 0) { - panePtr->minSize = 0; + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); + if (minSize < 0) { + Tcl_DecrRefCount(panePtr->minSizeObj); + panePtr->minSizeObj = Tcl_NewIntObj(0); + Tcl_IncrRefCount(panePtr->minSizeObj); } /* @@ -1503,6 +1509,7 @@ DisplayPanedWindow( GetFirstLastVisiblePane(pwPtr, &first, &last); for (i = 0; i < pwPtr->numPanes - 1; i++) { + panePtr = pwPtr->panes[i]; if (panePtr->hide || i == last) { continue; @@ -1513,9 +1520,11 @@ DisplayPanedWindow( 1, pwPtr->sashRelief); } if (pwPtr->showHandle) { + int handleSize; + Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->handleSizeObj, &handleSize); Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, panePtr->handlex, panePtr->handley, - pwPtr->handleSize, pwPtr->handleSize, 1, + handleSize, handleSize, 1, TK_RELIEF_RAISED); } } @@ -1733,6 +1742,7 @@ ArrangePanes( int first, last; int stretchReserve, stretchAmount; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + int handleSize; pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING); @@ -1772,17 +1782,20 @@ ArrangePanes( */ sashOffset = handleOffset = pwPtr->sashPad; - if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { - sashWidth = (2 * pwPtr->sashPad) + pwPtr->handleSize; - sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2) + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); + if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + sashWidth = (2 * pwPtr->sashPad) + handleSize; + sashOffset = ((handleSize - pwPtr->sashWidth) / 2) + pwPtr->sashPad; } else { sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth; - handleOffset = ((pwPtr->sashWidth - pwPtr->handleSize) / 2) + handleOffset = ((pwPtr->sashWidth - handleSize) / 2) + pwPtr->sashPad; } for (i = sashCount = 0; i < pwPtr->numPanes; i++) { + int padX, padY, minSize; + panePtr = pwPtr->panes[i]; if (panePtr->hide) { @@ -1794,25 +1807,28 @@ ArrangePanes( * or shortage of space available. */ + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX); + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY); if (horizontal) { if (panePtr->width > 0) { paneSize = panePtr->width; } else { paneSize = panePtr->paneWidth; } - stretchReserve -= paneSize + (2 * panePtr->padX); + stretchReserve -= paneSize + (2 * padX); } else { if (panePtr->height > 0) { paneSize = panePtr->height; } else { paneSize = panePtr->paneHeight; } - stretchReserve -= paneSize + (2 * panePtr->padY); + stretchReserve -= paneSize + (2 * padY); } + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); if (IsStretchable(panePtr->stretch,i,first,last) && Tk_IsMapped(pwPtr->tkwin)) { paneDynSize += paneSize; - paneDynMinSize += panePtr->minSize; + paneDynMinSize += minSize; } if (i != last) { stretchReserve -= sashWidth; @@ -1825,6 +1841,8 @@ ArrangePanes( */ for (i = 0; i < pwPtr->numPanes; i++) { + int padX, padY; + panePtr = pwPtr->panes[i]; if (panePtr->hide) { @@ -1849,7 +1867,7 @@ ArrangePanes( Tk_ReqWidth(panePtr->tkwin) + doubleBw); newPaneHeight = (panePtr->height > 0 ? panePtr->height : Tk_ReqHeight(panePtr->tkwin) + doubleBw); - paneMinSize = panePtr->minSize; + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &paneMinSize); /* * Calculate pane width and height. @@ -1880,7 +1898,7 @@ ArrangePanes( } paneDynSize -= paneSize; - paneDynMinSize -= panePtr->minSize; + paneDynMinSize -= paneMinSize; stretchAmount = (int) (frac * stretchReserve); if (paneSize + stretchAmount >= paneMinSize) { stretchReserve -= stretchAmount; @@ -1903,11 +1921,13 @@ ArrangePanes( stretchReserve = paneDynMinSize - paneDynSize; } } + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX); + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY); if (horizontal) { paneWidth = paneSize; - paneHeight = pwHeight - (2 * panePtr->padY); + paneHeight = pwHeight - (2 * padY); } else { - paneWidth = pwWidth - (2 * panePtr->padX); + paneWidth = pwWidth - (2 * padX); paneHeight = paneSize; } @@ -1951,7 +1971,7 @@ ArrangePanes( */ if (horizontal) { - x += paneWidth + (2 * panePtr->padX); + x += paneWidth + (2 * padX); if (x < internalBW) { x = internalBW; } @@ -1961,7 +1981,7 @@ ArrangePanes( panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += paneHeight + (2 * panePtr->padY); + y += paneHeight + (2 * padY); if (y < internalBW) { y = internalBW; } @@ -1981,8 +2001,8 @@ ArrangePanes( AdjustForSticky(panePtr->sticky, paneWidth, paneHeight, &paneX, &paneY, &newPaneWidth, &newPaneHeight); - paneX += panePtr->padX; - paneY += panePtr->padY; + paneX += padX; + paneY += padY; /* * Now put the window in the proper spot. @@ -2200,7 +2220,7 @@ ComputeGeometry( { int i, x, y, doubleBw, internalBw; int sashWidth, sashOffset, handleOffset; - int reqWidth, reqHeight, dim; + int reqWidth, reqHeight, dim, handleSize; Pane *panePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); @@ -2217,17 +2237,19 @@ ComputeGeometry( */ sashOffset = handleOffset = pwPtr->sashPad; - if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { - sashWidth = (2 * pwPtr->sashPad) + pwPtr->handleSize; - sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2) + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); + if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + sashWidth = (2 * pwPtr->sashPad) + handleSize; + sashOffset = ((handleSize - pwPtr->sashWidth) / 2) + pwPtr->sashPad; } else { sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth; - handleOffset = ((pwPtr->sashWidth - pwPtr->handleSize) / 2) + handleOffset = ((pwPtr->sashWidth - handleSize) / 2) + pwPtr->sashPad; } for (i = 0; i < pwPtr->numPanes; i++) { + int padX, padY, minSize; panePtr = pwPtr->panes[i]; if (panePtr->hide) { @@ -2248,13 +2270,14 @@ ComputeGeometry( * is by moving a sash, and that code checks the minsize. */ + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); if (horizontal) { - if (panePtr->paneWidth < panePtr->minSize) { - panePtr->paneWidth = panePtr->minSize; + if (panePtr->paneWidth < minSize) { + panePtr->paneWidth = minSize; } } else { - if (panePtr->paneHeight < panePtr->minSize) { - panePtr->paneHeight = panePtr->minSize; + if (panePtr->paneHeight < minSize) { + panePtr->paneHeight = minSize; } } @@ -2263,15 +2286,17 @@ ComputeGeometry( * parcel. */ + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX); + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY); if (horizontal) { - x += panePtr->paneWidth + (2 * panePtr->padX); + x += panePtr->paneWidth + (2 * padX); panePtr->sashx = x + sashOffset; panePtr->sashy = y; panePtr->handlex = x + handleOffset; panePtr->handley = y + pwPtr->handlePad; x += sashWidth; } else { - y += panePtr->paneHeight + (2 * panePtr->padY); + y += panePtr->paneHeight + (2 * padY); panePtr->sashx = x; panePtr->sashy = y + sashOffset; panePtr->handlex = x + pwPtr->handlePad; @@ -2296,7 +2321,7 @@ ComputeGeometry( doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw; } - dim += 2 * panePtr->padY; + dim += 2 * padY; if (dim > reqHeight) { reqHeight = dim; } @@ -2312,7 +2337,7 @@ ComputeGeometry( doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width; dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw; } - dim += 2 * panePtr->padX; + dim += 2 * padX; if (dim > reqWidth) { reqWidth = dim; } @@ -2620,6 +2645,7 @@ MoveSash( int stretchReserve = 0; int nextSash = sash + 1; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + int handleSize; if (diff == 0) return; @@ -2628,23 +2654,27 @@ MoveSash( * Update the pane sizes with their real sizes. */ - if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { - sashOffset = ((pwPtr->handleSize - pwPtr->sashWidth) / 2) + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); + if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + sashOffset = ((handleSize - pwPtr->sashWidth) / 2) + pwPtr->sashPad; } else { sashOffset = pwPtr->sashPad; } for (i = 0; i < pwPtr->numPanes; i++) { + int padX, padY; panePtr = pwPtr->panes[i]; if (panePtr->hide) { continue; } + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX); + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY); if (horizontal) { panePtr->paneWidth = panePtr->width = panePtr->sashx - - sashOffset - panePtr->x - (2 * panePtr->padX); + - sashOffset - panePtr->x - (2 * padX); } else { panePtr->paneHeight = panePtr->height = panePtr->sashy - - sashOffset - panePtr->y - (2 * panePtr->padY); + - sashOffset - panePtr->y - (2 * padY); } } @@ -2679,16 +2709,19 @@ MoveSash( * Calculate how much room we have to stretch in and adjust diff value * accordingly. */ + int minSize; + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); for (i = reduceFirst; i != reduceLast; i += reduceIncr) { + panePtr = pwPtr->panes[i]; if (panePtr->hide) { continue; } if (horizontal) { - stretchReserve += panePtr->width - panePtr->minSize; + stretchReserve += panePtr->width - minSize; } else { - stretchReserve += panePtr->height - panePtr->minSize; + stretchReserve += panePtr->height - minSize; } } if (stretchReserve <= 0) { @@ -2723,9 +2756,9 @@ MoveSash( } else { paneSize = panePtr->height; } - if (diff > (paneSize - panePtr->minSize)) { - diff -= paneSize - panePtr->minSize; - paneSize = panePtr->minSize; + if (diff > (paneSize - minSize)) { + diff -= paneSize - minSize; + paneSize = minSize; } else { paneSize -= diff; i = reduceLast - reduceIncr; @@ -3065,8 +3098,9 @@ PanedWindowIdentifyCoords( { int i, sashHeight, sashWidth, thisx, thisy; int found, isHandle, lpad, rpad, tpad, bpad; - int first, last; + int first, last, handleSize; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (Tk_IsMapped(pwPtr->tkwin)) { sashHeight = Tk_Height(pwPtr->tkwin); @@ -3074,10 +3108,10 @@ PanedWindowIdentifyCoords( sashHeight = Tk_ReqHeight(pwPtr->tkwin); } sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); - if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { - sashWidth = pwPtr->handleSize; - lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2; - rpad = pwPtr->handleSize - lpad; + if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + sashWidth = handleSize; + lpad = (handleSize - pwPtr->sashWidth) / 2; + rpad = handleSize - lpad; lpad += pwPtr->sashPad; rpad += pwPtr->sashPad; } else { @@ -3086,10 +3120,10 @@ PanedWindowIdentifyCoords( } tpad = bpad = 0; } else { - if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { - sashHeight = pwPtr->handleSize; - tpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2; - bpad = pwPtr->handleSize - tpad; + if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + sashHeight = handleSize; + tpad = (handleSize - pwPtr->sashWidth) / 2; + bpad = handleSize - tpad; tpad += pwPtr->sashPad; bpad += pwPtr->sashPad; } else { @@ -3127,11 +3161,11 @@ PanedWindowIdentifyCoords( thisx = pwPtr->panes[i]->handlex; thisy = pwPtr->panes[i]->handley; if (pwPtr->orient == ORIENT_HORIZONTAL) { - if (thisy <= y && y <= (thisy + pwPtr->handleSize)) { + if (thisy <= y && y <= (thisy + handleSize)) { isHandle = 1; } } else { - if (thisx <= x && x <= (thisx + pwPtr->handleSize)) { + if (thisx <= x && x <= (thisx + handleSize)) { isHandle = 1; } } From f378f79938ff4e194b11879c8d977f0ce0712712 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 31 Oct 2024 15:55:14 +0000 Subject: [PATCH 02/19] almost done, except widht/height --- generic/tkPanedWindow.c | 134 +++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 63 deletions(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 3dfcc0101..b49d7a1da 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -129,7 +129,6 @@ typedef struct PanedWindow { int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */ Tcl_Obj *widthObj; /* Tcl_Obj rep for width. */ Tcl_Obj *heightObj; /* Tcl_Obj rep for height. */ - int width, height; /* Width and height of the widget. */ enum orient orient; /* Orientation of the widget. */ Tk_Cursor cursor; /* Current cursor for window, or None. */ int resizeOpaque; /* Boolean indicating whether resize should be @@ -139,8 +138,9 @@ typedef struct PanedWindow { Tcl_Obj *sashPadObj; /* Tcl_Obj rep for sash padding. */ int showHandle; /* Boolean indicating whether sash handles * should be drawn. */ - int handlePad; /* Distance from border to draw handle. */ - Tcl_Obj *handleSizeObj; /* Tcl_Obj rep for handle size. */ + Tcl_Obj *handleSizeObj; /* Size of one side of a sash handle (handles + * are square), in pixels. */ + Tcl_Obj *handlePadObj; /* Distance from border to draw handle. */ Tk_Cursor sashCursor; /* Cursor used when mouse is above a sash. */ GC gc; /* Graphics context for copying from * off-screen pixmap onto screen. */ @@ -152,12 +152,8 @@ typedef struct PanedWindow { int numPanes; /* Number of panes. */ int sizeofPanes; /* Number of elements in the panes array. */ int flags; /* Flags for widget; see below. */ - Tcl_Obj *handlePadObj; #ifdef BUILD_tk - int borderWidth; /* Value of -borderwidth option. */ - int sashWidth; /* Width of each sash, in pixels. */ - int sashPad; /* Additional padding around each sash. */ - int proxyBorderWidth; /* Borderwidth used to draw proxy. */ + int width, height; /* Width and height of the widget. */ #endif } PanedWindow; @@ -283,13 +279,13 @@ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", - DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), offsetof(PanedWindow, borderWidth), + DEF_PANEDWINDOW_BORDERWIDTH, offsetof(PanedWindow, borderWidthObj), TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_PANEDWINDOW_CURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", - DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadObj), offsetof(PanedWindow, handlePad), + DEF_PANEDWINDOW_HANDLEPAD, offsetof(PanedWindow, handlePadObj), TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizeObj), @@ -308,7 +304,7 @@ static const Tk_OptionSpec optionSpecs[] = { (void *)DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth", DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthObj), - offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, + TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief", 0, TCL_INDEX_NONE, offsetof(PanedWindow, proxyRelief), TK_OPTION_NULL_OK, 0, 0}, @@ -318,14 +314,14 @@ static const Tk_OptionSpec optionSpecs[] = { DEF_PANEDWINDOW_SASHCURSOR, TCL_INDEX_NONE, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", - DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadObj), offsetof(PanedWindow, sashPad), + DEF_PANEDWINDOW_SASHPAD, offsetof(PanedWindow, sashPadObj), TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", DEF_PANEDWINDOW_SASHRELIEF, TCL_INDEX_NONE, offsetof(PanedWindow, sashRelief), 0, 0, 0}, {TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width", DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthObj), - offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY}, + TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle", DEF_PANEDWINDOW_SHOWHANDLE, TCL_INDEX_NONE, offsetof(PanedWindow, showHandle), 0, 0, GEOMETRY}, @@ -1308,6 +1304,7 @@ PanedWindowWorldChanged( XGCValues gcValues; GC newGC; PanedWindow *pwPtr = (PanedWindow *)instanceData; + int borderWidth; /* * Allocated a graphics context for drawing the paned window widget @@ -1326,7 +1323,8 @@ PanedWindowWorldChanged( * Issue geometry size requests to Tk. */ - Tk_SetInternalBorder(pwPtr->tkwin, pwPtr->borderWidth); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->borderWidthObj, &borderWidth); + Tk_SetInternalBorder(pwPtr->tkwin, borderWidth); if (pwPtr->width > 0 && pwPtr->height > 0) { Tk_GeometryRequest(pwPtr->tkwin, pwPtr->width, pwPtr->height); } @@ -1461,6 +1459,7 @@ DisplayPanedWindow( int i, sashWidth, sashHeight; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); int first, last; + int borderWidth; pwPtr->flags &= ~REDRAW_PENDING; if ((pwPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { @@ -1486,8 +1485,9 @@ DisplayPanedWindow( * Redraw the widget's background and border. */ + Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0, - Tk_Width(tkwin), Tk_Height(tkwin), pwPtr->borderWidth, + Tk_Width(tkwin), Tk_Height(tkwin), borderWidth, pwPtr->relief); /* @@ -1495,12 +1495,12 @@ DisplayPanedWindow( * coordinates). */ - if (horizontal) { + Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->sashWidthObj, &sashWidth); + if (horizontal) { sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); - sashWidth = pwPtr->sashWidth; } else { + sashHeight = sashWidth; sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); - sashHeight = pwPtr->sashWidth; } /* @@ -1742,7 +1742,7 @@ ArrangePanes( int first, last; int stretchReserve, stretchAmount; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); - int handleSize; + int handleSize, sashPad, handlePad; pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING); @@ -1781,16 +1781,16 @@ ArrangePanes( * and handle offsets. */ - sashOffset = handleOffset = pwPtr->sashPad; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad); + sashOffset = handleOffset = sashPad; Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); - if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { - sashWidth = (2 * pwPtr->sashPad) + handleSize; - sashOffset = ((handleSize - pwPtr->sashWidth) / 2) - + pwPtr->sashPad; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); + if (pwPtr->showHandle && handleSize > sashWidth) { + sashOffset = ((handleSize - sashWidth) / 2) + sashPad; + sashWidth = (2 * sashPad) + handleSize; } else { - sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth; - handleOffset = ((pwPtr->sashWidth - handleSize) / 2) - + pwPtr->sashPad; + handleOffset = ((sashWidth - handleSize) / 2) + sashPad; + sashWidth = (2 * sashPad) + sashWidth; } for (i = sashCount = 0; i < pwPtr->numPanes; i++) { @@ -1970,6 +1970,7 @@ ArrangePanes( * parcel and the location of the next parcel. */ + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handlePadObj, &handlePad); if (horizontal) { x += paneWidth + (2 * padX); if (x < internalBW) { @@ -1978,7 +1979,7 @@ ArrangePanes( panePtr->sashx = x + sashOffset; panePtr->sashy = y; panePtr->handlex = x + handleOffset; - panePtr->handley = y + pwPtr->handlePad; + panePtr->handley = y + handlePad; x += sashWidth; } else { y += paneHeight + (2 * padY); @@ -1987,7 +1988,7 @@ ArrangePanes( } panePtr->sashx = x; panePtr->sashy = y + sashOffset; - panePtr->handlex = x + pwPtr->handlePad; + panePtr->handlex = x + handlePad; panePtr->handley = y + handleOffset; y += sashWidth; } @@ -2223,6 +2224,7 @@ ComputeGeometry( int reqWidth, reqHeight, dim, handleSize; Pane *panePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); + int sashPad; pwPtr->flags |= REQUESTED_RELAYOUT; @@ -2236,20 +2238,20 @@ ComputeGeometry( * blindly (avoiding the extra showHandle, etc, checks). */ - sashOffset = handleOffset = pwPtr->sashPad; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad); + sashOffset = handleOffset = sashPad; Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); - if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { - sashWidth = (2 * pwPtr->sashPad) + handleSize; - sashOffset = ((handleSize - pwPtr->sashWidth) / 2) - + pwPtr->sashPad; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); + if (pwPtr->showHandle && handleSize > sashWidth) { + sashOffset = ((handleSize - sashWidth) / 2) + sashPad; + sashWidth = (2 * sashPad) + handleSize; } else { - sashWidth = (2 * pwPtr->sashPad) + pwPtr->sashWidth; - handleOffset = ((pwPtr->sashWidth - handleSize) / 2) - + pwPtr->sashPad; + handleOffset = ((sashWidth - handleSize) / 2) + sashPad; + sashWidth = (2 * sashPad) + sashWidth; } for (i = 0; i < pwPtr->numPanes; i++) { - int padX, padY, minSize; + int padX, padY, minSize, handlePad; panePtr = pwPtr->panes[i]; if (panePtr->hide) { @@ -2288,18 +2290,19 @@ ComputeGeometry( Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padXObj, &padX); Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->padYObj, &padY); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handlePadObj, &handlePad); if (horizontal) { x += panePtr->paneWidth + (2 * padX); panePtr->sashx = x + sashOffset; panePtr->sashy = y; panePtr->handlex = x + handleOffset; - panePtr->handley = y + pwPtr->handlePad; + panePtr->handley = y + handlePad; x += sashWidth; } else { y += panePtr->paneHeight + (2 * padY); panePtr->sashx = x; panePtr->sashy = y + sashOffset; - panePtr->handlex = x + pwPtr->handlePad; + panePtr->handlex = x + handlePad; panePtr->handley = y + handleOffset; y += sashWidth; } @@ -2645,7 +2648,7 @@ MoveSash( int stretchReserve = 0; int nextSash = sash + 1; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); - int handleSize; + int handleSize, sashPad, sashWidth; if (diff == 0) return; @@ -2655,11 +2658,12 @@ MoveSash( */ Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); - if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { - sashOffset = ((handleSize - pwPtr->sashWidth) / 2) - + pwPtr->sashPad; + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); + if (pwPtr->showHandle && handleSize > sashWidth) { + sashOffset = ((handleSize - sashWidth) / 2) + sashPad; } else { - sashOffset = pwPtr->sashPad; + sashOffset = sashPad; } for (i = 0; i < pwPtr->numPanes; i++) { int padX, padY; @@ -2829,6 +2833,8 @@ DisplayProxyWindow( PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; + int proxyBorderWidth; + pwPtr->flags &= ~PROXY_REDRAW_PENDING; if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; @@ -2849,9 +2855,10 @@ DisplayProxyWindow( * Redraw the widget's background and border. */ - Tk_Fill3DRectangle(tkwin, pixmap, + Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->proxyBorderWidthObj, &proxyBorderWidth); + Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->proxyBackground ? pwPtr->proxyBackground : pwPtr->background, - 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), pwPtr->proxyBorderWidth, + 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), proxyBorderWidth, (pwPtr->proxyRelief != TK_RELIEF_NULL) ? pwPtr->proxyRelief : pwPtr->sashRelief); #ifndef TK_NO_DOUBLE_BUFFERING @@ -2947,6 +2954,7 @@ PanedWindowProxyCommand( } internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (x < 0) { x = 0; @@ -2956,7 +2964,6 @@ PanedWindowProxyCommand( x = pwWidth; } y = Tk_InternalBorderLeft(pwPtr->tkwin); - sashWidth = pwPtr->sashWidth; sashHeight = Tk_Height(pwPtr->tkwin) - (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } else { @@ -2968,7 +2975,7 @@ PanedWindowProxyCommand( y = pwHeight; } x = Tk_InternalBorderLeft(pwPtr->tkwin); - sashHeight = pwPtr->sashWidth; + sashHeight = sashWidth; sashWidth = Tk_Width(pwPtr->tkwin) - (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } @@ -3098,9 +3105,11 @@ PanedWindowIdentifyCoords( { int i, sashHeight, sashWidth, thisx, thisy; int found, isHandle, lpad, rpad, tpad, bpad; - int first, last, handleSize; + int first, last, handleSize, sashPad; Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad); + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (Tk_IsMapped(pwPtr->tkwin)) { sashHeight = Tk_Height(pwPtr->tkwin); @@ -3108,27 +3117,26 @@ PanedWindowIdentifyCoords( sashHeight = Tk_ReqHeight(pwPtr->tkwin); } sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); - if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { - sashWidth = handleSize; - lpad = (handleSize - pwPtr->sashWidth) / 2; + if (pwPtr->showHandle && handleSize > sashWidth) { + lpad = (handleSize - sashWidth) / 2; rpad = handleSize - lpad; - lpad += pwPtr->sashPad; - rpad += pwPtr->sashPad; + lpad += sashPad; + rpad += sashPad; + sashWidth = handleSize; } else { - sashWidth = pwPtr->sashWidth; - lpad = rpad = pwPtr->sashPad; + lpad = rpad = sashPad; } tpad = bpad = 0; } else { - if (pwPtr->showHandle && handleSize > pwPtr->sashWidth) { + if (pwPtr->showHandle && handleSize > sashWidth) { sashHeight = handleSize; - tpad = (handleSize - pwPtr->sashWidth) / 2; + tpad = (handleSize - sashWidth) / 2; bpad = handleSize - tpad; - tpad += pwPtr->sashPad; - bpad += pwPtr->sashPad; + tpad += sashPad; + bpad += sashPad; } else { - sashHeight = pwPtr->sashWidth; - tpad = bpad = pwPtr->sashPad; + sashHeight = sashWidth; + tpad = bpad = sashPad; } if (Tk_IsMapped(pwPtr->tkwin)) { sashWidth = Tk_Width(pwPtr->tkwin); From 2e981741f5735af3d601026f54202f1a833c83d5 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 27 Nov 2024 16:20:28 +0000 Subject: [PATCH 03/19] Open release branch From e2fd863e782013dec49c927870e41ccf569fb40b Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 4 Dec 2024 15:53:36 +0000 Subject: [PATCH 04/19] changes generated by `make dist` --- unix/tkConfig.h.in | 3 --- 1 file changed, 3 deletions(-) diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index 5edf6530f..74da7ce42 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -31,9 +31,6 @@ /* Define to 1 if you have the 'lseek64' function. */ #undef HAVE_LSEEK64 -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the 'open64' function. */ #undef HAVE_OPEN64 From 572d11e9283f3b3525817883bbdeb96a75c4e430 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 4 Dec 2024 19:11:30 +0000 Subject: [PATCH 05/19] Tentative release date into the changes file. --- changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes b/changes index c93b8279a..ad2743d13 100644 --- a/changes +++ b/changes @@ -8252,4 +8252,4 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) 2024-11-25 (bug) [bcbf4c] Tk intialization overwrites thread specific data (emiliano) -- Released 8.6.16, ??? ??, 2024 - https://core.tcl-lang.org/tk/ for details +- Released 8.6.16, Dec 9, 2024 - https://core.tcl-lang.org/tk/ for details From 9d1a2e05f2312ba76ebdff0d6bbd2b85f3abe36c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 8 Dec 2024 18:34:18 +0000 Subject: [PATCH 06/19] PanedWindow.width|height done --- generic/tkPanedWindow.c | 42 +++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index b49d7a1da..db8cf8141 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -152,9 +152,6 @@ typedef struct PanedWindow { int numPanes; /* Number of panes. */ int sizeofPanes; /* Number of elements in the panes array. */ int flags; /* Flags for widget; see below. */ -#ifdef BUILD_tk - int width, height; /* Width and height of the widget. */ -#endif } PanedWindow; /* @@ -292,7 +289,7 @@ static const Tk_OptionSpec optionSpecs[] = { TCL_INDEX_NONE, 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightObj), - offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, + TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize", DEF_PANEDWINDOW_OPAQUERESIZE, TCL_INDEX_NONE, offsetof(PanedWindow, resizeOpaque), 0, 0, 0}, @@ -327,7 +324,7 @@ static const Tk_OptionSpec optionSpecs[] = { 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthObj), - offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY}, + TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; @@ -1304,7 +1301,7 @@ PanedWindowWorldChanged( XGCValues gcValues; GC newGC; PanedWindow *pwPtr = (PanedWindow *)instanceData; - int borderWidth; + int borderWidth, width = -1, height = -1; /* * Allocated a graphics context for drawing the paned window widget @@ -1325,8 +1322,14 @@ PanedWindowWorldChanged( Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->borderWidthObj, &borderWidth); Tk_SetInternalBorder(pwPtr->tkwin, borderWidth); - if (pwPtr->width > 0 && pwPtr->height > 0) { - Tk_GeometryRequest(pwPtr->tkwin, pwPtr->width, pwPtr->height); + if (pwPtr->widthObj) { + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->widthObj, &width); + } + if (pwPtr->heightObj) { + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->heightObj, &height); + } + if (width > 0 && height > 0) { + Tk_GeometryRequest(pwPtr->tkwin, width, height); } /* @@ -2225,6 +2228,7 @@ ComputeGeometry( Pane *panePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); int sashPad; + int width = -1, height = -1; pwPtr->flags |= REQUESTED_RELAYOUT; @@ -2365,16 +2369,22 @@ ComputeGeometry( * otherwise, use the requested width/height. */ + if (pwPtr->widthObj) { + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->widthObj, &width); + } + if (pwPtr->heightObj) { + Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->heightObj, &height); + } if (horizontal) { - reqWidth = (pwPtr->width > 0 ? - pwPtr->width : x - sashWidth + internalBw); - reqHeight = (pwPtr->height > 0 ? - pwPtr->height : reqHeight + (2 * internalBw)); + reqWidth = (width > 0 ? + width : x - sashWidth + internalBw); + reqHeight = (height > 0 ? + height : reqHeight + (2 * internalBw)); } else { - reqWidth = (pwPtr->width > 0 ? - pwPtr->width : reqWidth + (2 * internalBw)); - reqHeight = (pwPtr->height > 0 ? - pwPtr->height : y - sashWidth + internalBw); + reqWidth = (width > 0 ? + width : reqWidth + (2 * internalBw)); + reqHeight = (height > 0 ? + height : y - sashWidth + internalBw); } Tk_GeometryRequest(pwPtr->tkwin, reqWidth, reqHeight); if (Tk_IsMapped(pwPtr->tkwin) && !(pwPtr->flags & REDRAW_PENDING)) { From 7adcb58ee1ffe6438351bfdb8ddd6c694f92a1b9 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 8 Dec 2024 22:01:13 +0000 Subject: [PATCH 07/19] Fix [6bdf1a7ec3]: Bind mechanism vs. GNOME --- generic/tkInt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic/tkInt.h b/generic/tkInt.h index 76c1dcdf8..d4d677d7b 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1095,10 +1095,10 @@ typedef struct TkpClipMask { #endif #ifndef Button6Mask -# define Button6Mask (1<<13) +# define Button6Mask (AnyModifier<<6) #endif #ifndef Button7Mask -# define Button7Mask (1<<14) +# define Button7Mask (AnyModifier<<7) #endif #ifndef Button8Mask # define Button8Mask (AnyModifier<<4) From 459b2ff1f671e324d510a20139e2fdfe4b8df20f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 8 Dec 2024 22:07:40 +0000 Subject: [PATCH 08/19] Update changes.md --- changes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changes.md b/changes.md index a59fb478c..4db32266b 100644 --- a/changes.md +++ b/changes.md @@ -22,6 +22,8 @@ Release Tk 9.0.1 arises from the check-in with tag `core-9-0-1`. - [Tk intialization overwrites thread specific data](https://core.tcl-lang.org/tk/tktview/bcbf4c) - [File clamTheme.tcl misses code related to the -indicatorforeground option](https://core.tcl-lang.org/tk/tktview/a69fd7) - [Segfault when using menu(button) with the -font option](https://core.tcl-lang.org/tk/tktview/8ce672) + - [TIP #706: Expose three Tk "In Context" functions via stubs table](https://core.tcl-lang.org/tips/doc/trunk/tip/706.md) + - [Bind mechanism vs. GNOME](https://core.tcl-lang.org/tk/tktview/6bdf1a) Release Tk 9.0.0 arises from the check-in with tag `core-9-0-0`. From d12a04084c06f3fb681a4a69faceff40aef8818a Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 Dec 2024 10:34:59 +0000 Subject: [PATCH 09/19] Fix indenting --- generic/tkPanedWindow.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index a0e413ff4..cfb4f0e80 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -1488,8 +1488,7 @@ DisplayPanedWindow( Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->borderWidthObj, &borderWidth); Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background, 0, 0, - Tk_Width(tkwin), Tk_Height(tkwin), borderWidth, - pwPtr->relief); + Tk_Width(tkwin), Tk_Height(tkwin), borderWidth, pwPtr->relief); /* * Set up boilerplate geometry values for sashes (width, height, common @@ -1497,7 +1496,7 @@ DisplayPanedWindow( */ Tk_GetPixelsFromObj(NULL, tkwin, pwPtr->sashWidthObj, &sashWidth); - if (horizontal) { + if (horizontal) { sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); } else { sashHeight = sashWidth; @@ -1783,7 +1782,7 @@ ArrangePanes( */ Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashPadObj, &sashPad); - sashOffset = handleOffset = sashPad; + sashOffset = handleOffset = sashPad; Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->handleSizeObj, &handleSize); Tk_GetPixelsFromObj(NULL, pwPtr->tkwin, pwPtr->sashWidthObj, &sashWidth); if (pwPtr->showHandle && handleSize > sashWidth) { From aa9084ce8f7e4c23a90b59d5b664a8a524b6ea87 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Dec 2024 15:25:43 +0000 Subject: [PATCH 10/19] silence compiler warning --- generic/tkPanedWindow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index cfb4f0e80..dc35cbd90 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -2651,7 +2651,7 @@ MoveSash( { int i; int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset; - Pane *panePtr; + Pane *panePtr = NULL; int stretchReserve = 0; int nextSash = sash + 1; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); From c9ca6b23f3afe49fbd1cb2b6ad36cfec3b8e329c Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 9 Dec 2024 17:44:09 +0000 Subject: [PATCH 11/19] Update release date --- changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes b/changes index ad2743d13..2d1290d49 100644 --- a/changes +++ b/changes @@ -8252,4 +8252,4 @@ Tk Cocoa 2.0: More drawing internals refinements (culler,walzer) 2024-11-25 (bug) [bcbf4c] Tk intialization overwrites thread specific data (emiliano) -- Released 8.6.16, Dec 9, 2024 - https://core.tcl-lang.org/tk/ for details +- Released 8.6.16, Dec 11, 2024 - https://core.tcl-lang.org/tk/ for details From a0d4dce8e3de9ef7b246599756366c6744cd2c53 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Dec 2024 11:18:26 +0000 Subject: [PATCH 12/19] Fix "minSize" handling in panedWindow, introduced [68ed671a8fafd45b|here] --- generic/tkPanedWindow.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index dc35cbd90..e284edfb3 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -2651,7 +2651,7 @@ MoveSash( { int i; int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset; - Pane *panePtr = NULL; + Pane *panePtr; int stretchReserve = 0; int nextSash = sash + 1; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); @@ -2674,6 +2674,7 @@ MoveSash( } for (i = 0; i < pwPtr->numPanes; i++) { int padX, padY; + panePtr = pwPtr->panes[i]; if (panePtr->hide) { continue; @@ -2720,15 +2721,14 @@ MoveSash( * Calculate how much room we have to stretch in and adjust diff value * accordingly. */ - int minSize; - - Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); for (i = reduceFirst; i != reduceLast; i += reduceIncr) { + int minSize; panePtr = pwPtr->panes[i]; if (panePtr->hide) { continue; } + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); if (horizontal) { stretchReserve += panePtr->width - minSize; } else { @@ -2758,6 +2758,8 @@ MoveSash( */ for (i = reduceFirst; i != reduceLast; i += reduceIncr) { + int minSize; + panePtr = pwPtr->panes[i]; if (panePtr->hide) { continue; @@ -2767,6 +2769,7 @@ MoveSash( } else { paneSize = panePtr->height; } + Tk_GetPixelsFromObj(NULL, panePtr->tkwin, panePtr->minSizeObj, &minSize); if (diff > (paneSize - minSize)) { diff -= paneSize - minSize; paneSize = minSize; From 9ded1a83ae80b4653d592180eb431a474e333cbc Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Dec 2024 11:29:19 +0000 Subject: [PATCH 13/19] Reduce the possibility for a conflict in Button8Mask/Button9Mask definition. See: [6bdf1a7ec3] --- generic/tkInt.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/generic/tkInt.h b/generic/tkInt.h index d4d677d7b..b66e98468 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1094,6 +1094,14 @@ typedef struct TkpClipMask { # define Button9 9 #endif +/* + * The ButtonMask modifiers for in {6 7 8 9} + * are internally used by Tk. They must be above the + * AnyModifier bit since anything below is reserved + * for the X protocol. If a future X11 version + * defines these, we adhere. + */ + #ifndef Button6Mask # define Button6Mask (AnyModifier<<6) #endif @@ -1101,10 +1109,10 @@ typedef struct TkpClipMask { # define Button7Mask (AnyModifier<<7) #endif #ifndef Button8Mask -# define Button8Mask (AnyModifier<<4) +# define Button8Mask (AnyModifier<<8) #endif #ifndef Button9Mask -# define Button9Mask (AnyModifier<<5) +# define Button9Mask (AnyModifier<<9) #endif /* From f1385876ecc3b1e8a1a0ae159bc1f86230565837 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 10 Dec 2024 13:26:39 +0000 Subject: [PATCH 14/19] [b3a1b9852d] is not a bug. See [https://core.tcl-lang.org/tips/doc/trunk/tip/158.md|TIP #158] --- changes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/changes.md b/changes.md index 447ba234c..80a77bf4d 100644 --- a/changes.md +++ b/changes.md @@ -59,7 +59,6 @@ writing Tcl scripts containing Tk commands. ## Known bugs - [Inconsistent reporting of child geometry changes to grid container](https://core.tcl-lang.org/tk/tktview/beaa8e) - [Inconsistency in whether widgets allow negative borderwidths](https://core.tcl-lang.org/tk/tktview/5f739d) - - [Enter key works differently in Windows and Linux](https://core.tcl-lang.org/tk/tktview/b3a1b9) - [slow widget creation if default font is not used](https://core.tcl-lang.org/tk/tktview/8da7af) - [The wm manage command does not work on current macOS versions](https://core.tcl-lang.org/tk/tktview/8a6012) - [Slow processing irregular transparencies](https://core.tcl-lang.org/tk/tktview/919066) From 4a81592509239d440ee132ba59b122fa2bceba3c Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 11 Dec 2024 08:43:16 +0000 Subject: [PATCH 15/19] Eliminate PREFER_MOST_SPECIALIZED_EVENT, since it's always 1 and not documented. Backport some error-message changes from Tk 9.0 --- generic/tkBind.c | 24 +++++------------------- generic/tkCmds.c | 8 ++++---- tests/winfo.test | 2 +- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index 2365fc1a9..0a765dbc6 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -49,18 +49,6 @@ * Non-package-specific helpers. */ -/* - * In old implementation (the one that used an event ring), and <1><1> were - * equivalent sequences. However it is logical to give higher precedence - * since it is more specific. Indeed includes time and space requirements, - * which is not the case for <1><1>. - * This is achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1. - */ - -#ifndef PREFER_MOST_SPECIALIZED_EVENT -# define PREFER_MOST_SPECIALIZED_EVENT 1 -#endif - /* * Traditionally motion events can be combined with buttons in this way: . * However it should be allowed to express this as in addition. This is achieved @@ -2131,13 +2119,12 @@ IsBetterMatch( if (diff > 0) { return 1; } if (diff < 0) { return 0; } -#if PREFER_MOST_SPECIALIZED_EVENT { /* local scope */ -#define M (Tcl_WideUInt)1000000 - static const Tcl_WideUInt weight[5] = { 0, 1, M, M*M, M*M*M }; +#define M 1000000ULL + static const unsigned long long weight[5] = { 0, 1, M, M*M, M*M*M }; #undef M - Tcl_WideUInt fstCount = 0; - Tcl_WideUInt sndCount = 0; + unsigned long long fstCount = 0; + unsigned long long sndCount = 0; unsigned i; /* @@ -2159,7 +2146,6 @@ IsBetterMatch( if (sndCount > fstCount) { return 1; } if (sndCount < fstCount) { return 0; } } -#endif return sndMatchPtr->number > fstMatchPtr->number; } @@ -3938,7 +3924,7 @@ HandleEventGenerate( mainPtr = (TkWindow *) mainWin; if (!tkwin || mainPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window id \"%s\" doesn't exist in this application", + "window id \"%s\" does not exist in this application", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW", Tcl_GetString(objv[0]), (char *)NULL); return TCL_ERROR; diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 108d73044..695762dd4 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -100,7 +100,7 @@ Tk_BellObjCmd( }; enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; Tk_Window tkwin = (Tk_Window)clientData; - int i; + Tcl_Size i; int index, nice = 0; Tk_ErrorHandler handler; @@ -490,7 +490,7 @@ Tk_DestroyObjCmd( { Tk_Window window; Tk_Window tkwin = (Tk_Window)clientData; - int i; + Tcl_Size i; for (i = 1; i < objc; i++) { window = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), tkwin); @@ -1302,7 +1302,7 @@ Tk_WinfoObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int index, x, y, width, height, useX, useY, c_class; - int skip; + Tcl_Size skip; const char *string; TkWindow *winPtr; Tk_Window tkwin = (Tk_Window)clientData; @@ -1678,7 +1678,7 @@ Tk_WinfoObjCmd( if ((winPtr == NULL) || (winPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "window id \"%s\" doesn't exist in this application", + "window id \"%s\" does not exist in this application", string)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW", string, (char *)NULL); return TCL_ERROR; diff --git a/tests/winfo.test b/tests/winfo.test index b9949b898..76c57c975 100644 --- a/tests/winfo.test +++ b/tests/winfo.test @@ -239,7 +239,7 @@ test winfo-7.5 {"winfo pathname" command} -body { } -returnCodes error -result {expected integer but got "xyz"} test winfo-7.6 {"winfo pathname" command} -body { winfo pathname 224 -} -returnCodes error -result {window id "224" doesn't exist in this application} +} -returnCodes error -result {window id "224" does not exist in this application} test winfo-7.7 {"winfo pathname" command} -setup { destroy .b button .b -text "Help" From 8005dc4cf739ba62ab7e4a683f0d3b75a429f9a6 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 11 Dec 2024 10:26:48 +0000 Subject: [PATCH 16/19] Eliminate SUPPORT_ADDITIONAL_MOTION_SYNTAX (always 1) too --- generic/tkBind.c | 24 ++++-------------------- tests/wm.test | 4 ++-- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index c93e86902..b3d19eedb 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -49,16 +49,6 @@ * Non-package-specific helpers. */ -/* - * Traditionally motion events can be combined with buttons in this way: . - * However it should be allowed to express this as in addition. This is achieved - * by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1. - */ - -#ifndef SUPPORT_ADDITIONAL_MOTION_SYNTAX -# define SUPPORT_ADDITIONAL_MOTION_SYNTAX 1 -#endif - /* * The output for motion events is of the type . This can be changed to become * instead by setting PRINT_SHORT_MOTION_SYNTAX to 1, however this would be a @@ -69,11 +59,6 @@ # define PRINT_SHORT_MOTION_SYNTAX 0 /* set to 1 if wanted */ #endif -#if !SUPPORT_ADDITIONAL_MOTION_SYNTAX -# undef PRINT_SHORT_MOTION_SYNTAX -# define PRINT_SHORT_MOTION_SYNTAX 0 -#endif - /* * For debugging only, normally set to zero. */ @@ -3015,7 +3000,7 @@ ExpandPercents( for (string = before; *string && *string != '%'; ++string) ; if (string != before) { - Tcl_DStringAppend(dsPtr, before, (Tcl_Size)(string - before)); + Tcl_DStringAppend(dsPtr, before, string - before); before = string; } if (!*before) { @@ -4991,6 +4976,7 @@ ParseEventDescription( eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); + patPtr->eventType = eiPtr->type; eventFlags = flagArray[eiPtr->type]; eventMask = eiPtr->eventMask; @@ -5001,7 +4987,7 @@ ParseEventDescription( if ((eventFlags & BUTTON) || (button && eventFlags == 0) - || (SUPPORT_ADDITIONAL_MOTION_SYNTAX && (eventFlags & MOTION) && button == 0)) { + || ((eventFlags & MOTION) && button == 0)) { /* This must be a button (or bad motion) event. */ if (button == 0) { return FinalizeParseEventDescription( @@ -5028,14 +5014,13 @@ ParseEventDescription( eventMask = KeyPressMask; } } else if (button) { - if (!SUPPORT_ADDITIONAL_MOTION_SYNTAX || patPtr->eventType != MotionNotify) { + if (patPtr->eventType != MotionNotify) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("specified button \"%s\" for non-button event", field), "NON_BUTTON"); } -#if SUPPORT_ADDITIONAL_MOTION_SYNTAX patPtr->modMask |= Tk_GetButtonMask(button); p = SkipFieldDelims(p); while (*p && *p != '>') { @@ -5049,7 +5034,6 @@ ParseEventDescription( patPtr->modMask |= Tk_GetButtonMask(button); } patPtr->info = ButtonNumberFromState(patPtr->modMask); -#endif } else { return FinalizeParseEventDescription( interp, diff --git a/tests/wm.test b/tests/wm.test index ea366a5d4..85aaa9044 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1511,10 +1511,10 @@ test wm-stackorder-2.3 {stacking order} -body { toplevel .t2 tkwait visibility .t2 raiseDelay - lappend res [wm stackorder .] + lappend res [wm stackorder .] raise . raiseDelay - lappend res [wm stackorder .] + lappend res [wm stackorder .] raise .t2 raiseDelay lappend res [wm stackorder .] From cd07540a9e4e863cde6de5ee790a119cd24e7ada Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2024 15:57:46 +0000 Subject: [PATCH 17/19] (cherry-pick): Eliminate SUPPORT_ADDITIONAL_MOTION_SYNTAX (always 1) too --- generic/tkBind.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index 0a765dbc6..4c7f18a2f 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -49,16 +49,6 @@ * Non-package-specific helpers. */ -/* - * Traditionally motion events can be combined with buttons in this way: . - * However it should be allowed to express this as in addition. This is achieved - * by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1. - */ - -#ifndef SUPPORT_ADDITIONAL_MOTION_SYNTAX -# define SUPPORT_ADDITIONAL_MOTION_SYNTAX 1 -#endif - /* * The output for motion events is of the type . This can be changed to become * instead by setting PRINT_SHORT_MOTION_SYNTAX to 1, however this would be a @@ -69,11 +59,6 @@ # define PRINT_SHORT_MOTION_SYNTAX 0 /* set to 1 if wanted */ #endif -#if !SUPPORT_ADDITIONAL_MOTION_SYNTAX -# undef PRINT_SHORT_MOTION_SYNTAX -# define PRINT_SHORT_MOTION_SYNTAX 0 -#endif - /* * For debugging only, normally set to zero. */ @@ -3015,7 +3000,7 @@ ExpandPercents( for (string = before; *string && *string != '%'; ++string) ; if (string != before) { - Tcl_DStringAppend(dsPtr, before, (Tcl_Size)(string - before)); + Tcl_DStringAppend(dsPtr, before, string - before); before = string; } if (!*before) { @@ -4991,6 +4976,7 @@ ParseEventDescription( eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); + patPtr->eventType = eiPtr->type; eventFlags = flagArray[eiPtr->type]; eventMask = eiPtr->eventMask; @@ -5001,7 +4987,7 @@ ParseEventDescription( if ((eventFlags & BUTTON) || (button && eventFlags == 0) - || (SUPPORT_ADDITIONAL_MOTION_SYNTAX && (eventFlags & MOTION) && button == 0)) { + || ((eventFlags & MOTION) && button == 0)) { /* This must be a button (or bad motion) event. */ if (button == 0) { return FinalizeParseEventDescription( @@ -5028,14 +5014,13 @@ ParseEventDescription( eventMask = KeyPressMask; } } else if (button) { - if (!SUPPORT_ADDITIONAL_MOTION_SYNTAX || patPtr->eventType != MotionNotify) { + if (patPtr->eventType != MotionNotify) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("specified button \"%s\" for non-button event", field), "NON_BUTTON"); } -#if SUPPORT_ADDITIONAL_MOTION_SYNTAX patPtr->modMask |= Tk_GetButtonMask(button); p = SkipFieldDelims(p); while (*p && *p != '>') { @@ -5049,7 +5034,6 @@ ParseEventDescription( patPtr->modMask |= Tk_GetButtonMask(button); } patPtr->info = ButtonNumberFromState(patPtr->modMask); -#endif } else { return FinalizeParseEventDescription( interp, @@ -5195,7 +5179,7 @@ GetPatternObj( modMask = patPtr->modMask; #if PRINT_SHORT_MOTION_SYNTAX if (patPtr->eventType == MotionNotify) { - modMask &= ~(ModMask)ALL_BUTTONS; + modMask &= ~(unsigned)ALL_BUTTONS; } #endif From 4cda3bf388fb4695172608794cff1ef3c57ca471 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2024 16:06:57 +0000 Subject: [PATCH 18/19] Make sure that tkUuid.h doesn't end up in "make dist" --- unix/Makefile.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 51818cee1..b531e5c04 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1698,7 +1698,8 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC rm -rf $(DISTDIR) $(INSTALL_DATA_DIR) $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(TOP_DIR)/manifest.uuid $(DISTDIR) - $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix + $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/tkUnixDefault.h \ + $(UNIX_DIR)/tkUnixInt.h $(UNIX_DIR)/tkUnixPort.h $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tk.spec \ $(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \ @@ -1727,7 +1728,10 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.in $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/configure.ac \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ - $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat \ + $(TOP_DIR)/win/*.c $(TOP_DIR)/win/*.bat \ + $(TOP_DIR)/win/tkWin.h $(TOP_DIR)/win/tkWinDefault.h \ + $(TOP_DIR)/win/tkWinIco.h $(TOP_DIR)/win/tkWinInt.h \ + $(TOP_DIR)/win/tkWinPort.h $(TOP_DIR)/win/tkWinSendCom.h \ $(TOP_DIR)/win/*.vc $(TOP_DIR)/win/README \ $(TOP_DIR)/license.terms \ $(DISTDIR)/win From 8df66fd9ddceda611228d4a80237dcd5df60295f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 12 Dec 2024 16:25:12 +0000 Subject: [PATCH 19/19] (cherry-pick): Make sure that tkUuid.h doesn't end up in "make dist" --- unix/Makefile.in | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/unix/Makefile.in b/unix/Makefile.in index 5cca69cdd..bf2ae5189 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -1563,7 +1563,8 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC rm -rf $(DISTDIR) mkdir -p $(DISTDIR)/unix cp -p $(TOP_DIR)/manifest.uuid $(DISTDIR) - cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix + cp -p $(UNIX_DIR)/*.c $(UNIX_DIR)/tkUnixDefault.h \ + $(UNIX_DIR)/tkUnixInt.h $(UNIX_DIR)/tkUnixPort.h $(DISTDIR)/unix cp $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix chmod 664 $(DISTDIR)/unix/Makefile.in cp $(UNIX_DIR)/configure $(UNIX_DIR)/configure.in $(UNIX_DIR)/tk.spec \ @@ -1592,14 +1593,15 @@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC $(TTK_DIR)/ttkGenStubs.tcl $(DISTDIR)/generic/ttk mkdir $(DISTDIR)/win cp $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win - cp $(TOP_DIR)/win/configure \ + cp -p $(TOP_DIR)/win/configure \ $(TOP_DIR)/win/*.in \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ - $(DISTDIR)/win - cp -p $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win - cp -p $(TOP_DIR)/win/*.vc $(DISTDIR)/win - cp -p $(TOP_DIR)/win/README $(DISTDIR)/win - cp -p $(TOP_DIR)/license.terms $(DISTDIR)/win + $(TOP_DIR)/win/*.c $(TOP_DIR)/win/*.bat \ + $(TOP_DIR)/win/tkWin.h $(TOP_DIR)/win/tkWinDefault.h \ + $(TOP_DIR)/win/tkWinInt.h \ + $(TOP_DIR)/win/tkWinPort.h $(TOP_DIR)/win/tkWinSendCom.h \ + $(TOP_DIR)/win/*.vc $(TOP_DIR)/win/README \ + $(TOP_DIR)/license.terms $(DISTDIR)/win mkdir $(DISTDIR)/win/rc cp -p $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/ cp -p $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc