]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/ioncore_misc.lua
[svn-upgrade] Integrating new upstream version, ion3 (20070318)
[ion3.git] / ioncore / ioncore_misc.lua
index 3b24b668e5ac2507f120e79199ae650a925aef2c..4637279d798fa7c108b32a97a6c4ae58927b3f53 100644 (file)
@@ -80,10 +80,24 @@ function ioncore.TR(s, ...)
 end
 
 
---[[DOC
--- Run \var{cmd} with the environment variable DISPLAY set to point to the
--- root window of the X screen \var{reg} is on.
-function ioncore.exec_on(reg, cmd)
-    return ioncore.do_exec_rw(reg:rootwin_of(), cmd)
+--DOC
+-- Attach tagged regions to \var{reg}. The method of attach
+-- depends on the types of attached regions and whether \var{reg} 
+-- implements \code{attach_framed} and \code{attach}. If \var{param}
+-- is not set, the default of \verb!{switchto=true}! is used.
+function ioncore.tagged_attach(reg, param)
+    if not param then
+        param={switchto=true}
+    end
+    local tagged=function() return ioncore.tagged_first(true) end
+    for r in tagged do
+        local fn=((not obj_is(r, "WWindow") and reg.attach_framed) 
+                  or reg.attach)
+        
+        if not (fn and fn(reg, r, param)) then
+            return false
+        end
+    end
+    return true
 end
---]]
+