Hello
Thanks for the info, now I understand.. I thought it was because of the regexp 
which wasn't working and which ou changed from a regexp to a 
'scan'... because I looked at the old regexp and noticed that it was expecting 
\dx\d+\d+\d which the 'wm geomtry' can sometimes return 
something like 100x100+0+-10 (negative value still preceded with a '+')
and the regexp in gui.tcl fixes it...
anyways, now I understand your problem, and I have a solution for it if you 
want to need the decorations width/height... I tested it and it 
worked under Windows, but I don't know about other WM.. I tried it also on 
Enlightenment, and it works... 
so you said winfo should return the geometry including decorations and wm 
return it without decorations.. I see that on windows the 
decorations are never included, the winfo geometry and wm geometry return the 
exact same thing... on E16 though, it works as expected... 
anyways, the solution would be
winfo rootx $w
winfo rooty $w
when you do wm geometry, you get the x and y pos from the geometry, then you do 
x - rootx == 'border width' and y - rooty == border height.
this seems to always work on my windows and linux PCs... I tried other 
combinations and it is indeed inconsistent... 
on windows, winfo and wm geometry return the same thing, but 'winfo x' return 
the x without decorations and 'winfo rootx' return the x with 
decorations...
on E16, the winfo and wm geometry return respectively with and without 
decorations as expected, but 'winfo rootx' is the same as 'winfo x' 
and 'winfo rooty' gives the same result as 'winfo y'.... so it's all fucked up.
But anyways, it is consistent that 'winfo rootx' and 'winfo rooty' give the 
positions including decorations.
So you can use that.. and 'wm geometry' is consistent in giving the geometry 
without decorations... 
I hope this helps!

KKRT

On Sat, Aug 19, 2006 at 04:06:29PM +0300, ?lvaro J. Iradier wrote:
> Hi Youness, thanks for your help, but the regexp is not the problem,
> but the different window managers reporting different and strange
> geometrys. The thing is, I used some code in wiki.tcl.tk to get the
> windows decoration size (title bar and decorations). To find out this
> size, you need to find the difference between [wm geometry $w] and
> [winfo geometry $w]. One shoudl report the position of the Window
> (including decorations), and the other one the position of the window
> contents.
> 
> On some window managers, they are both the same (this is not a
> problem, window decoration size and window tite size will be zero, and
> everything will work as usual). Problem is, in some tests, I noticed
> winfo geometry returned +0+0 as position, while wm geometry returned
> the right position (or viceversa), and this made no sense, and the
> dimensions where all fucked up. So after testing and testing and
> testing I just aded a catch while setting the final window geometry,
> to avoid these problems.
> 
> Without the new code, moveinscreen procedure would work bad in some
> window managers (try running "moveinscreen .", and you'll notice the
> window will start "moving" around the screen, even if it's already
> inside, due to the decorations size being ignored).
> 
> Greets.
> 
> On 8/18/06, Youness Alaoui <[EMAIL PROTECTED]> wrote:
> > Hello,
> > You didn't like the regexp and you're right, it was wrong, but why all the 
> > hassle into changing the method, why not
> > just fix the regexp? if you needed help, I can always help in regexp, I 
> > know them very well.. in the meantime, a simple
> > 'grep geometry * | grep regexp' would have givven you a line in gui.tcl 
> > which looks like this :
> > gui.tcl:        regexp {=?(\d+)x(\d+)[+\-](-?\d+)[+\-](-?\d+)} $geometry -> 
> > width height x y
> >
> > This is the 'corrected' regexp you had in preferences.tcl, it takes into 
> > account negative values and have been
> > 'studied' according to Tk manuals and well tested to make sure it works in 
> > every situation (dual screen too iirc)
> >
> > Why not revert the changes and use this instead ? tell me what you think
> >
> >
> > KKRT
> >
> > On Fri, Aug 18, 2006 at 06:43:20AM -0700, [EMAIL PROTECTED] wrote:
> > > Revision: 7137
> > > Author:   airadier
> > > Date:     2006-08-18 06:43:16 -0700 (Fri, 18 Aug 2006)
> > > ViewCVS:  http://svn.sourceforge.net/amsn/?rev=7137&view=rev
> > >
> > > Log Message:
> > > -----------
> > > Damn window managers driving me mad with moveinscreen... It wasn't
> > > working correctly before. Now it should, but there are same special
> > > cases where WM returns wrong geometry information. Catching the WM call
> > > to avoid errors.
> > >
> > > Modified Paths:
> > > --------------
> > >     trunk/amsn/preferences.tcl
> > > Modified: trunk/amsn/preferences.tcl
> > > ===================================================================
> > > --- trunk/amsn/preferences.tcl        2006-08-18 11:17:47 UTC (rev 7136)
> > > +++ trunk/amsn/preferences.tcl        2006-08-18 13:43:16 UTC (rev 7137)
> > > @@ -2581,41 +2581,51 @@
> > >
> > >       #set winx [winfo width $window]
> > >       #set winy [winfo height $window]
> > > +
> > >       set scrx [winfo screenwidth .]
> > >       set scry [winfo screenheight .]
> > > -     set winpx [winfo rootx $window]
> > > -     set winpy [winfo rooty $window]
> > > +
> > > +     set wi_geometry [winfo geometry $window]
> > > +     scan $wi_geometry "%dx%d+%d+%d" winx winy winpx winpy
> > > +
> > > +     #set winpx [winfo x $window]
> > > +     #set winpy [winfo y $window]
> > >
> > >       set geom [wm geometry $window]
> > >       scan $geom "%dx%d%c%d%c%d" winx winy sign1 decorationLeft sign2 
> > > decorationTop
> > >
> > >       # Measure left edge, and assume all edges except top are the
> > >       # same thickness
> > > -     if { $sign1 == 45 || $decorationLeft < 0} { ;#'-' character
> > > -             set decorationThickness 0
> > > +     if { $sign1 == 45} { ;#'-' character
> > > +             #Get size from right decoration
> > > +             set decorationThickness [expr {($scrx - $decorationLeft) - 
> > > ($winpx + $winx)}]
> > > +             status_log "Minus: dec=$decorationThickness --> ($scrx + 
> > > $decorationLeft) - ($winpx + $winx)\n"
> > >       } else {
> > >               set decorationThickness [expr {$winpx - $decorationLeft}]
> > >       }
> > >
> > >       # Find titlebar and menubar thickness
> > > -     if { $sign2 == 45 || $decorationTop < 0 } { ;#'-' character
> > > -             set menubarThickness 0
> > > +     if { $sign2 == 45 } { ;#'-' character
> > > +             set menubarThickness [expr {($scry - $decorationLeft) - 
> > > ($winpy + $winy)}]
> > >       } else {
> > >               set menubarThickness [expr {$winpy - $decorationTop}]
> > >       }
> > >
> > >
> > > -     #status_log "Window information: $window\n" white
> > > -     #status_log "Geometry: $geom\n (menuThickness= $menubarThickness, 
> > > dec=$decorationThickness)\n"
> > > -     #status_log "Width, height: [winfo width $window]x[winfo height 
> > > $window]\n"
> > > -     #status_log "winPx, winPy: $winpx,$winpy\n"
> > > -     #status_log "decLeft=$decorationLeft / decTop=$decorationTop\n"
> > > -     #status_log "-------------------\n" white
> > > +     status_log "Window information: $window\n" white
> > > +     status_log "Geometry: $geom\n (menuThickness= $menubarThickness, 
> > > dec=$decorationThickness)\n"
> > > +     status_log "Width, height: [winfo width $window]x[winfo height 
> > > $window]\n"
> > > +     status_log "winPx, winPy: $winpx,$winpy\n"
> > > +     status_log "decLeft=$decorationLeft / decTop=$decorationTop\n"
> > > +     status_log "-------------------\n" white
> > >
> > > +
> > >       # Add this decoration size when checking size and limits
> > >       incr winx [expr {2 * $decorationThickness}]
> > >       incr winy $decorationThickness
> > >       incr winy $menubarThickness
> > > +     incr winpx [expr {0 - $decorationThickness}]
> > > +     incr winpy [expr {0 - $menubarThickness}]
> > >
> > >       #check if the window is too large to fit on the screen
> > >       if { [expr {$winx > ($scrx-(2*$mindist))}] } {
> > > @@ -2644,9 +2654,8 @@
> > >       incr winx [expr {0 - 2 * $decorationThickness}]
> > >       incr winy [expr {0 - $decorationThickness}]
> > >       incr winy [expr {0 - $menubarThickness }]
> > > -     incr winpx [expr {0 - $decorationThickness}]
> > > -     incr winpy [expr {0 - $menubarThickness}]
> > > -     wm geometry $window "${winx}x${winy}+${winpx}+${winpy}"
> > > +
> > > +     catch {wm geometry $window "${winx}x${winy}+${winpx}+${winpy}"}
> > >  }
> > >
> > >  proc reload_advanced_options {path} {
> > >
> > >
> > > This was sent by the SourceForge.net collaborative development platform, 
> > > the world's largest Open Source development site.
> > >
> > >
> > > -------------------------------------------------------------------------
> > > Using Tomcat but need to do more? Need to support web services, security?
> > > Get stuff done quickly with pre-integrated technology to make your job 
> > > easier
> > > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > > _______________________________________________
> > > Amsn-commits mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/amsn-commits
> >
> 
> 
> -- 
> (:===========================================:)
>   Alvaro J. Iradier Muro - [EMAIL PROTECTED]
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Amsn-devel mailing list
> Amsn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/amsn-devel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to