|
2004-06-16
| ||
| 04:59 | • Ticket [940220ffff] wm geometry contradictions (and inadequately documented status still Open with 5 other changes artifact: 7fc2d95c78 user: jenglish | |
|
2004-05-22
| ||
| 00:30 | • Ticket [940220ffff]: 4 changes artifact: b8a09e39e7 user: vincentdarley | |
|
2004-05-20
| ||
| 18:45 | • Ticket [940220ffff]: 6 changes artifact: 638b0b1af1 user: vincentdarley | |
|
2004-04-22
| ||
| 18:31 | • New ticket [940220ffff]. artifact: 1db283bb24 user: vincentdarley | |
| Ticket UUID: | 940220 | |||
| Title: | wm geometry contradictions (and inadequately documented | |||
| Type: | Bug | Version: | obsolete: 8.5a2 | |
| Submitter: | vincentdarley | Created on: | 2004-04-22 18:31:53 | |
| Subsystem: | 62. Geometry Functions | Assigned To: | jenglish | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Open | Last Modified: | 2004-06-16 04:59:02 | |
| Resolution: | None | Closed By: | ||
| Closed on: | ||||
| Description: |
The documentation of "wm geometry $win" doesn't make
clear whether the quantities referred to are relative
to the toplevel window's border or the window manager
decoration (titlebar, menubar with configure -menu, etc).
In fact on windows, the returned value is:
contentsWidth x contentsHeight
+ decorationLeft + decorationTop
which is rather surprising. This means to find the
total number of vertical pixels covered by the
toplevel, including any menubar/titlebar/border, we
must perform a complex calculation (and must actually
assume the bottom edge and right edge decoration are
the same thickness as the left edge decoration). So,
here's a function to determine, as best possible, the
total geometry covered by a window:
proc default::totalGeometry {{w .}} {
set geom [wm geometry $w]
regexp -- {([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)}
$geom -> \
width height decorationLeft decorationTop
set contentsTop [winfo rooty $w]
set contentsLeft [winfo rootx $w]
# Measure left edge, and assume all edges except
top are the
# same thickness
set decorationThickness [expr {$contentsLeft -
$decorationLeft}]
# Find titlebar and menubar thickness
set menubarThickness [expr {$contentsTop -
$decorationTop}]
incr width [expr {2 * $decorationThickness}]
incr height $decorationThickness
incr height $menubarThickness
return [list $width $height $decorationLeft
$decorationTop]
}
Nowhere in the documentation are these issues/terms
made clear. So, while I know the above works on
Windows, I really cannot be sure it works on other
platforms. The documentation should be fixed (and this
proc could be used as an example, perhaps).
| |||
| User Comments: |
jenglish added on 2004-06-16 04:59:02:
Logged In: YES user_id=68433 Reassigning to me; see also #220791. vincentdarley added on 2004-05-22 00:30:59: Logged In: YES user_id=32170 According to http://mini.net/tcl/11502, This depends on the window manager. Under metacity (Gnome's WM), twm, and others, wm geometry . +$x+$y places the upper-left corner of the window decoration at $x,$y; under MWM and 4DWM, it places the upper-left corner of the window contents there. I'm pretty sure this is because tkUnixWm.c isn't doing the right thing according to the ICCCM -- it looks like it's trying to implement the first behaviour (place window decorations), but it does so by attempting to second-guess what the WM is going to do. Under many WMs, it guesses wrong. This means even between different X11 wm's the behaviour is inconsistent for something as simple as 'wm geometry . +0+0' vincentdarley added on 2004-05-20 18:45:53: Logged In: YES user_id=32170 Furthermore, on X11, the behaviour is totally different! On X11 it is impossible to get the decoration sizes, and in fact 'wm geometry' operates only on the window contents. This means, for example, that 'wm geometry +0+0' performs totally differently on Windows vs X11. | |||