This improves the behaviour with print()ing for debugging, when the
output is redirected to a file.
I was using `setbuf(…, 0)` initially, but it makes sense to buffer it
per line. This uses `setvbuf` instead of `setlinebuf`, which might not
be available everywhere.
Closes https://github.com/awesomeWM/awesome/pull/267
Run the following code:
do
local d
local f = function() d.visible = true end
if _VERSION >= "Lua 5.2" then
setmetatable({}, { __gc = f })
else
getmetatable(newproxy(true)).__gc = f
end
d = drawin({})
end
collectgarbage("collect")
Awesome will segfault.
The reason for this is that after the above code ran, all variables in it are
unreferenced and will be garbage-collected at the next sweep phase. Lua runs
garbage collectors in the inverse order that their corresponding objects were
"marked" which means for the above code that the drawin's garbage collector will
run before function f runs. So the code will access the drawin after its
destructor already ran. Obviously, awesome's C code does not expect nor
correctly deal with this situation and was dereferencing a NULL pointer.
To fix this, this commit "unsets" the metatable of a userdata object when it is
being garbage collected. Since the type of a userdata is inferred via its
metatable, the object will no longer be accepted by luaA_toudata().
For the above code this will result in an unhelpful error message saying that
something tried to index a userdata, but userdata cannot be indexed. At least we
no longer crash and the traceback of the error will hopefully point at some __gc
metamethod which should be enough of a hint to figure out the problem.
Thanks-to: http://blog.reverberate.org/2014/06/beware-of-lua-finalizers-in-c-modules.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
Adding @AWESOME_VERSION@ to the LDoc description is useful to have on
the index page. While at it, it makes the description more
verbose/correct.
For docs/02-contributing.md, it lists the current aliases for typed
parameters, prefers/mentions `@tparam` and `@treturn` only, and fixes
some minor wording.
Closes#262.
Calling lua_tostring() on a number/integer, turns that stack slot into a string.
This patch changes the code to only call lua_tostring() if the function argument
really is a string.
This partly also caused https://github.com/awesomeWM/awesome/issues/238.
Signed-off-by: Uli Schlachter <psychon@znc.in>
In commit 3cbdc2a79f, the argument order for awful.layout.inc was changed
from (layouts, i, s) to (i, s, layouts), so that layouts can become an optional
parameter. However, this change (obviously) breaks user configs.
To hide this breakage, we assume the old argument order if the number i is a
table. This cannot break anything, since the operator "+" will error out on
tables anyway. :-)
Signed-off-by: Uli Schlachter <psychon@znc.in>
I doubt that this makes much of a difference since lgi surely caches things, but
this still seems nicer to me.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Since commit 52ec0ebd93, layouts should return the geometries to their caller
instead of setting them directly. The caller will also fix up the geometries for
border width.
Signed-off-by: Uli Schlachter <psychon@znc.in>
When you are restoring previously minimized windows, you definetely want
focus on them.
Closes: https://github.com/awesomeWM/awesome/pull/234.
Signed-off-by: Rastislav Barlik <barlik@zoho.com>
This adds an optional `filter` arg to awful.client.focus.history.get,
and uses `awful.client.focus.filter` from the autofocus module.
This improves the behaviour when manually setting clients as
non-focusable (#237), and is considered to be the desired behaviour in
general.
Closes https://github.com/awesomeWM/awesome/pull/242.
Sometimes is a good idea to check if notifications are suspended,
for example, for changing the icon. This function just returns the value
of suspended.
Closes https://github.com/awesomeWM/awesome/pull/222.