Tk Source Code

View Ticket
Login
Ticket UUID: 917631
Title: Grid information in wm may be incorrect (patch included)
Type: Bug Version: obsolete: 8.5a1
Submitter: ruric Created on: 2004-03-16 21:48:50
Subsystem: 48. Geometry Management Assigned To: pspjuth
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2025-03-19 22:05:16
Resolution: None Closed By: nobody
    Closed on:
Description:
The grid information provided to the window manager if
-setgrid is used may be incorrect. The window manager
is given information based on the requested size, not
the actual size. It may also become confused by resizes
if the gridded window does not get all the size-change.

The consequences may be serious since if the window
actually becomes much bigger than requested then it may
be impossible to scale it down to a reasonable size
since minsize is based on when tk thinks the window
will be 1x1.

I have attached a compressed tarfile which contains two
demostration scripts and a patch.  The demonstration
scripts each puts up a paned window (implemented with
pack and panedwindow) containing a listbox and a text
widget. Radiobuttons allows one to switch the widget
controlling the grid. Try resizing the window and
notice that the grid information in the window manager
often is completely wrong.

I have tested this on Unix (ctwm). The patch includes
code for Mac and Windows(empty functions) but I have
not been able to test these parts. The patch defines a
new function Tk_UpdateGrid() which the listbox and text
widgets calls whenever they are resized. I also
modified the internal UpdateSizeHints() function to
either use the requested size or the actual size.
User Comments: fvogel added on 2025-03-19 22:05:16:

See also [7c51624a96].


fvogel added on 2015-07-12 13:26:53:
While hunting the cause for  http://core.tcl.tk/tk/tktview/3466588fff  I came across this ticket, which looks similar.

I have applied the patch for the Windows part. This required some manual tweaking, since more than ten years later the codebase changed. Unfortunately, unless I made a mistake in applying the patch, it did not fix anything for me.

ruric added on 2004-03-17 04:48:51:

File Added - 80340: setgrid_bug.tar.gz

Attachments: