[comp.windows.x] twm/tvtwm NoTitle screws up xterm font change window resizes

casey@gauss.llnl.gov (Casey Leedom) (10/07/90)

[[Also sent to xbugs@expo.lcs.mit.edu]]

VERSION:
    R4/PL14

CLIENT MACHINE and OPERATING SYSTEM:
    Sun3 running SunOS 3.5

DISPLAY TYPE:
    bwtwo0

WINDOW MANAGER:
    twm

AREA:
    mit/clients/twm/resize.c

SYNOPSIS:
    Twm doesn't compute xterm font change window resizes correctly
    when NoTitle is set.

DESCRIPTION:
    If I turn off title bars for xterms via NoTitle in my twmrc, then
    when I change fonts in my xterms (control right mouse button) the new
    window size is computed incorrectly.  (Try it yourself.  It's
    impossible to describe what looks like totally random size
    computations.)  This problem occurs with both twm and tvtwm.

REPEAT BY:
    Run twm as your window manager.  Start up an xterm.  Change fonts in
    that xterm several times and observe that while the font does change,
    the new window size if often computed incorrectly causing the window
    to change size somewhat randomly.

SAMPLE FIX:
    I've struggled through the code and have narrowed the problem down to a
    call to XMoveResizeWindow() in twm's SetupWindow() at line 716 in
    resize.c.  The problem is in the height parameter
    "h-tmp_win->title_height."  The values of "h" are equal to the height of
    the window + the height of a title bar (even though the window doesn't
    have a title bar.)  The value of "tmp_win->title_height" is 0 because the
    window doesn't have a title bar.  I changed the expression to
    "h-title_height" ("title_height" is the height of title bars.)  This
    corrects the wild size changes that I see when you change fonts in xterm,
    but still screws up the height of the window by about the size of a title
    bar.

    At this point I'm totally out of answers.  Would someone more capable
    than me figure out exactly what needs to be done to fix this problem?
    I'd really like to be able to change my font dynamically.