chiark / gitweb /
setimage
[chiark-tcl-applet.git] / applet.tcl
index 2bb9ac4452ec172e04845e57c6f8d59ad7b6971c..e660bce7acbba766981b75cf9a68ab5052ee2c6c 100644 (file)
@@ -30,6 +30,12 @@ package require tktray
 #      applet::tooltip-set TEXT-MAYBE-MULTILINE
 #   whenever they like.
 #
+# Icon:
+#
+#  Caller should call:
+#      applet::setimage IMAGE
+#  as necessary.
+#
 # Inner window subprocess:
 #
 #  Caller that needs access to inner window should define
@@ -47,6 +53,9 @@ package require tktray
 #    Alternatively caller may call  applet::setup-button-menu $b
 #    which will generate a menu .m$b which the user can configure
 #    and which will automatically be posted and unposted etc.
+#    In this case the caller should arrange that all of their
+#    menus, when an item is selected, call
+#      applet::msel
 
 wm withdraw .
 
@@ -159,6 +168,12 @@ proc tooltip-show {x y} {
     uplevel #0 $tooltip_on_vis
 }
 
+#----- simple images -----
+
+proc setimage {image} {
+    .i configure -image $image
+}
+
 }
 
 
@@ -212,49 +227,3 @@ proc setupinnerwindow {w} {
     destroy [frame .i.i.make-exist]
     bind .i <<IconConfigure>> { innerwindow-resetup-required IconConfigure }
 }
-
-
-
-proc setimage {image} {
-    .i configure -image $image
-}
-
-proc fork-then {ondeath inchild} {
-    global children errorCode errorInfo
-    foreach f {stdout stderr} {
-       if {[catch { flush $f } emsg]} {
-           catch { bgerror $emsg }
-       }
-    }
-    set pid [fork]
-    if {!$pid} { 
-       if {[catch { 
-           uplevel 1 $inchild
-       } emsg]} {
-           puts stderr "CHILD ERROR $emsg\n$errorCode\n$errorInfo\n"
-       }
-       kill KILL [id process]
-    }
-    set children($pid) $ondeath
-    return $pid
-}
-
-proc chld-handler {} {
-    global children
-    while 1 {
-       if {[catch { set got [wait -nohang] }]} break
-       if {![llength $got]} break
-       manyset $got pid how how2
-       if {[info exists children($pid)]} {
-           set l $children($pid)
-           unset children($pid)
-           if {[catch {
-               uplevel #0 [concat [list $l] $how $how2]
-           } emsg]} {
-               catch { bgerror $emsg }
-           }
-       }
-    }  
-}
-
-signal -restart trap CHLD { after idle chld-handler }