[PD] openpanel window popup behaviour

CICCOLIX ciccolix at tiscalinet.it
Wed Aug 26 20:00:39 CEST 2009


Hans-Christoph Steiner ha scritto:
>
> On Aug 26, 2009, at 3:01 AM, CICCOLIX wrote:
>
>> glerm soares ha scritto:
>>>
>>> Hiya,
>>>
>>> Is the openpanel popup window for choosing files default behaviour 
>>> to appear back from the window you are running your patch? Seems tha 
>>> this don't make too much sense and the worse is that some people get 
>>> stuck when the window is invisible if the patch is with window 
>>> maximized. I have seem this several times...
>>>
>>> Strange that in ubuntu-gnome with compiz working the default 
>>> behaviour is not that because the window is poping up in front of 
>>> all patches. That's the more desirable, but seems that's it is 
>>> dependent of desktop configs?
>>>
>>> Is there anyway to assure the openpanel window will popup in front 
>>> of the running patch window?
>> yes, I did this by modifying the source code of pd.tk, just adding 
>> the -parent option to the tk_getOpenFile command.
>> The proc "pdtk_openpanel" modified look like this:
>>
>>
>> proc pdtk_openpanel {target localdir} {
>>   global pd_opendir
>>   if {$localdir == ""} {
>>     set localdir $pd_opendir
>>   }
>> ##discover the patch window in front of you
>>   set last_patch_window [lindex [split [wm stackorder .] " "] end]
>> ##tell tcl to make the opened panel to be cild of the patch in front 
>> of you
>>   set filename [tk_getOpenFile -parent $last_patch_window -initialdir 
>> $localdir]
>>   if {$filename != ""} {
>>       set directory [string range $filename 0 \
>>           [expr [string last / $filename ] - 1]]
>>       set pd_opendir $directory
>>
>>       pd [concat $target callback [pdtk_enquote $filename] \;]
>>   }
>> }
>
>
> Does that solve the problem on GNU/Linux?  Miller included something 
> like this in 0.42.5 so it would be good to have confirmation that it 
> works.
>
> .hc 

I have tested this on pd-vanilla 0.42-5 on ubuntu linux (standard gnome 
desktop).

It does not work only launching the patch via command line es. "pd -open 
mypatch.pd" because in that case, in the stack order, the patch appear 
before the main window of pd.

you can see this behavior by putting this line somewhere in the 
"pdtk_openpanel" proc:

puts [wm stackorder .]

the result is:
.x83d6de0 .
where .x83d6de0 is the patch end . is the main pd.
In any other case the result is reversed, the last item will always be 
the patch in the foreground.
--
Lazzaro






More information about the Pd-list mailing list