Seb Haezebrouck
2009-06-01 14:20:19 UTC
Hi,
Since I do not like having empty frames on my screen, I figured I'll try and
write a small function that would close the frame if I close the last client
in a frame. This is the (wrong) code I came up with. Could not find a better
way than this io.write thing to debug what was going on.
function close_test(wmp)
local c = WMPlex.mx_count(wmp)
io.output("/tmp/dbg.ionscript")
io.write("Number of children: ", c, ".\n")
if WRegion.rqclose_propagate(wmp, _sub) then
io.write("Closed one child.\n")
if c == 1 then
while WMPlex.mx_count(wmp) == 1 do
io.write("Still one child seen.\n")
end
WRegion.rqclose(wmp)
end
end
end
... and as I half expected - this goes into an infinite loop when I try and
use it on a frame in which there is only one client (and the client is not
destroyed).
I am sure Ion3 can do what I want... but could someone tell me what is wrong
with my script, and what is the proper way, if any to make this function not
blocking?
Looks like a hook (deinit ?) is probably what I really need, but I am afraid
I might run into the same type of issue. And all my feebles attempts to
implement hooks so far miserably failed.
Thanks,
Seb
PS: I am using ion3-20090110.
Since I do not like having empty frames on my screen, I figured I'll try and
write a small function that would close the frame if I close the last client
in a frame. This is the (wrong) code I came up with. Could not find a better
way than this io.write thing to debug what was going on.
function close_test(wmp)
local c = WMPlex.mx_count(wmp)
io.output("/tmp/dbg.ionscript")
io.write("Number of children: ", c, ".\n")
if WRegion.rqclose_propagate(wmp, _sub) then
io.write("Closed one child.\n")
if c == 1 then
while WMPlex.mx_count(wmp) == 1 do
io.write("Still one child seen.\n")
end
WRegion.rqclose(wmp)
end
end
end
... and as I half expected - this goes into an infinite loop when I try and
use it on a frame in which there is only one client (and the client is not
destroyed).
I am sure Ion3 can do what I want... but could someone tell me what is wrong
with my script, and what is the proper way, if any to make this function not
blocking?
Looks like a hook (deinit ?) is probably what I really need, but I am afraid
I might run into the same type of issue. And all my feebles attempts to
implement hooks so far miserably failed.
Thanks,
Seb
PS: I am using ion3-20090110.