click module extra functions

This commit is contained in:
p.kosyh 2010-11-07 12:04:18 +00:00
parent 114f659a26
commit d4b8ee1680

View file

@ -1,8 +1,31 @@
click = {
nam = 'click';
object_type = true;
system_type = true;
bg = false;
save = function(self, name, h, need)
local s = stead.tostring(self.bg)
h:write(stead.string.format("click[%q] = %s;\n", 'bg', s))
end;
}
stead.module_init(function()
input.click = stead.hook(input.click,
function(f, s, press, mb, x, y, px, py, ...)
if press and px then
return "click "..px..','..py;
local cmd = 'click '
if press then
if click.bg then
cmd = cmd .. x .. ','.. y
if px then
cmd = cmd .. ','
end
end
if px then
cmd = cmd .. px .. ',' .. py
end
if cmd ~= 'click ' then
return cmd
end
end
return f(s, press, mb, x, y, px, py, unpack(arg))
end)