aboutsummaryrefslogtreecommitdiff
path: root/bin/pddp
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pddp')
-rw-r--r--bin/pddp/pddpserver.tcl27
-rw-r--r--bin/pddp/pkgIndex.tcl2
2 files changed, 23 insertions, 6 deletions
diff --git a/bin/pddp/pddpserver.tcl b/bin/pddp/pddpserver.tcl
index 4b96be2..eb01207 100644
--- a/bin/pddp/pddpserver.tcl
+++ b/bin/pddp/pddpserver.tcl
@@ -303,15 +303,32 @@ proc ::pddp::srvTimeout {sock} {
srvError $sock 408
}
-# FIXME test if "path" has its patch window already open...
-proc ::pddp::srvPdHandler {sock path} {
+proc ::pddp::srvPdOpen {path} {
+ global menu_windowlist
+ set name [file tail $path]
set dir [file dirname $path]
- set tail [file tail $path]
- if {[catch {pd [concat pd open $tail $dir \;]}]} {
+ # FIXME white space in $name and $dir
+ # FIXME this is a fragile hack, there should be an "openx" message to pd...
+ foreach en $menu_windowlist {
+ set wd [lindex $en 1]
+ set nm [lindex $en 0]
+ set dr [lindex [wm title $wd] end]
+ if {[string equal $name $nm] && [string equal $dir $dr]} {
+ # FIXME test on windows
+ raise $wd
+ focus -force $wd
+ return
+ }
+ }
+ pd [concat pd open $name $dir \;]
+ # FIXME raise and focus on windows?
+}
+
+proc ::pddp::srvPdHandler {sock path} {
+ if {[catch {::pddp::srvPdOpen $path}]} {
srvError $sock 504
} else {
srvError $sock 204
- # FIXME raise; focus (test on windows)
}
}
diff --git a/bin/pddp/pkgIndex.tcl b/bin/pddp/pkgIndex.tcl
index a3abe3d..10b89a6 100644
--- a/bin/pddp/pkgIndex.tcl
+++ b/bin/pddp/pkgIndex.tcl
@@ -5,6 +5,6 @@ proc LoadPddp { version dir } {
source [file join $dir pddpboot.tcl]
}
-set version "0.1.0.2"
+set version "0.1.0.3"
package ifneeded pddp $version [list LoadPddp $version $dir]