Tk Source Code

View Ticket
Login
Ticket UUID: 568861
Title: Fix for wm minsize and maxsize commands
Type: Patch Version: None
Submitter: mdejong Created on: 2002-06-14 06:10:54
Subsystem: 65. Generic Window Operations Assigned To: mdejong
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-03-12 07:37:04
Resolution: Accepted Closed By: mdejong
    Closed on: 2003-03-12 00:37:04
Description:
This patch is fixes problems with the wm minsize
and wm maxsize commands. The basic problem is
that one can use wm geom to set sizes that should
not be allowed. There was also a bug where
the window would not be resized when the minsize
or maxsize was changed and a resize was required.

I have added a number of test cases to the wm.test
file. I have also removed tests from the unixWm.test
file that were marked with the nonPortable constraint.
These tests would fail, they were not being run
by default, and in addition my tests are more complete.
My tests also cover gridded windows.

I see two possible arguments against my patch. First,
that there is a conflict between the docs for minsize
and maxsize and the implementation. The docs state
that these method should be a no-op when the wm
resizable command has been used to turn off the
resizable prop. Thing is, the resizable docs
only mention what the user can do interactively.
My patch will make the window resize to the new
min or max size and then not allow resizing after
that. In addition, this is violated by the wm geom
command which can resize a window even if the
wm resizable prop is turned off.

The other argument against the test cases is that
they might not work on other window managers. For
example, I had to take care to use windows that
would not be too small under Win32, since it has
a lower limit for window widths. It is possible
that tests might fail under some window managers.
Those problems will have to be dealt with as they
come up. The benefit of actually testing the wm
code across multiple platforms should outweigh
the cost of touching up the tests so they work
for some specific (meaning buggy) wm.
User Comments: mdejong added on 2003-03-12 07:37:04:
Logged In: YES 
user_id=90858

Added to CVS on 2003-03-11.

mdejong added on 2003-02-20 01:12:03:

File Deleted - 25142: 



File Added - 42887: min_max.patch4

Logged In: YES 
user_id=90858

I have attached an updated version of this patch that applies
cleanly to the current CVS. The patch is just a correct now
and it was 6 months ago, so I think it is ready to apply.

hobbs added on 2003-02-19 04:31:46:
Logged In: YES 
user_id=72656

Is this still valid?

mdejong added on 2002-06-15 07:54:05:

File Deleted - 25088:

mdejong added on 2002-06-15 07:54:04:

File Added - 25142: min_max.patch3

Logged In: YES 
user_id=90858

I have attached an updated patch that should
be the final form of this patch. It fixes the
minsize and maxsize commands, updates the docs
for these two functions, and adds a bunch of
testcases. The impl has been tested under Win32
and Linux and passes all the test (at least, I
think so, I am getting some strange results
from bind 15.23 under Win32, but I am not sure
if it is a result of TIP #47)

mdejong added on 2002-06-15 05:12:46:

File Added - 25135: width_height.patch

mdejong added on 2002-06-15 05:12:45:
Logged In: YES 
user_id=90858

After some more looking, I found that there was
a problem with the combination of the wm resizable
method and a minsize or maxsize window. Basically,
there was no way to tell the UpdateSizeHints method
in tkUnixWm.c that the window was being resized.
It would set the min and max values for the WM
based on the old window size, not the new size
being calculated un a UpdateGeometry call. I looked
for a number a solutions, but the only one that really
made any sense was to just pass the new width and
height into the function call. I have attached a little
patch file for this one change. Does this seem like the
right approach? I have test cases to check all this,
I just wanted to see if the general approach looked
ok. This is the only place in the code where the
update function is called.

mdejong added on 2002-06-15 01:22:11:
Logged In: YES 
user_id=90858

I thought about this some more and reread all the
wm documentation. I think the "right" way to get
the documentation to match the implementation is
to change the docs. The following patch would get
the wm.n file into shape. I will also look into
some more test cases for the combination of these
wm methods.

Index: doc/wm.n
===================================================================
RCS file: /cvsroot/tktoolkit/tk/doc/wm.n,v
retrieving revision 1.9
diff -u -0 -r1.9 wm.n
--- doc/wm.n    13 Jun 2002 06:33:36 -0000      1.9
+++ doc/wm.n    14 Jun 2002 18:11:14 -0000
@@ -288,2 +287,0 @@
-If resizing has been disabled with the \fBwm resizable\fR
command,
-then this command has no effect.
@@ -304,2 +301,0 @@
-If resizing has been disabled with the \fBwm resizable\fR
command,
-then this command has no effect.

This is the only place in the docs where the wm resizable
is mentioned outside of the resiable description.

hobbs added on 2002-06-14 14:32:52:
Logged In: YES 
user_id=72656

sounds OK to me, but something that should be yellow 
flagged during the beta period.

mdejong added on 2002-06-14 13:10:55:

File Added - 25088: min_max.patch

Attachments: