On Mon, 2010-08-23 at 13:04 +0200, Frank Barknecht wrote: > On Sat, Aug 21, 2010 at 01:16:10PM -0700, Miller Puckette wrote: > > I'm getting similar behavior using evilwm and hope to look into it :) > > I found this TODO comment in pdtk_canvas.tcl: > > #TODO: http://wiki.tcl.tk/11502 > # MS Windows > #wm geometry . returns > contentswidthxcontentsheight+decorationTop+decorationLeftEdge. > #and > #winfo rooty . returns contentsTop > #winfo rootx . returns contentsLeftEdge > > http://wiki.tcl.tk/11502 looks as if it describes exactly the problem we > have. Unfortunatly it's over my head. :) > > Ciao
Really, I think the problem is that Pd forces new windows to be 450x300 +0+0. What should be happening is that Pd should let the Window Manager position the window. Unfortunately the way canvas_new() and in turn pdtk_canvas_new are currently structured, there isn't an easy way to do that. But I whipped up this working kludge that just detects the default values that pd sends to pdtk_canvas_new when its a new patch, then let the window manager do the positioning in that case. Try it out and see how it works for you. .hc
commit 0217e7331d546f7223defb483fa4745114e4f7f5 Author: Hans-Christoph Steiner <h...@eds.org> Date: Tue Aug 31 16:57:27 2010 -0400 Tcl-only kludge which allows window manager to position new patches diff --git a/tcl/pdtk_canvas.tcl b/tcl/pdtk_canvas.tcl index 682bb13..790aca7 100644 --- a/tcl/pdtk_canvas.tcl +++ b/tcl/pdtk_canvas.tcl @@ -33,32 +33,40 @@ namespace eval ::pdtk_canvas:: { # canvas new/saveas proc pdtk_canvas_new {mytoplevel width height geometry editable} { - set screenwidth [winfo screenwidth .] - set screenheight [winfo screenheight .] - - # read back the current geometry +posx+posy into variables - scan $geometry {%[+]%d%[+]%d} - x - y - # fit the geometry onto screen - set x [ expr $x % $screenwidth - $::windowframex] - set y [ expr $y % $screenheight - $::windowframey] - if {$width > $screenwidth} { - set width $screenwidth - set x 0 - } - if {$height > $screenheight} { - set height [expr $screenheight - $::menubarsize - 30] ;# 30 for window framing - set y $::menubarsize +# kludge to allow windows for new patches to be placed by the window +# manager. Right now the geometry of a new patch window is set in canvas_new() +# in g_canvas.c whether its a new patch or just loading an existing patch. + if { $width == 450 && $height == 300 && $editable == 1 && \ + ($geometry eq "+0+0" || $geometry eq "+0+22")} { + set existingwindow 0 + } else { + set existingwindow 1 + set screenwidth [winfo screenwidth .] + set screenheight [winfo screenheight .] + + # read back the current geometry +posx+posy into variables + scan $geometry {%[+]%d%[+]%d} - x - y + # fit the geometry onto screen + set x [ expr $x % $screenwidth - $::windowframex] + set y [ expr $y % $screenheight - $::windowframey] + if {$width > $screenwidth} { + set width $screenwidth + set x 0 + } + if {$height > $screenheight} { + set height [expr $screenheight - $::menubarsize - 30] ;# 30 for window framing + set y $::menubarsize + } + set geometry ${width}x$height+$x+$y } - set geometry ${width}x$height+$x+$y - set ::loaded($mytoplevel) 0 toplevel $mytoplevel -width $width -height $height -class PatchWindow wm group $mytoplevel . $mytoplevel configure -menu $::patch_menubar - + event generate $mytoplevel <<Loading>> - - wm geometry $mytoplevel $geometry + + if {$existingwindow} {wm geometry $mytoplevel $geometry} wm minsize $mytoplevel $::canvas_minwidth $::canvas_minheight set tkcanvas [tkcanvas_name $mytoplevel]
_______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list