Commit Graph

6978 Commits

Author SHA1 Message Date
Uli Schlachter b1e7d3c22c Call check_widget() in :setup()
I just spent too much time tracking down a bug that happened while drawing a
widget. This is the reason why we should apply sanity checks while widgets are
constructed, so that we get a useful backtrace.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 13:58:48 +01:00
Uli Schlachter cf3c81fa9e Implement :set_children() sanely everywhere
This makes the code use the existing functions for setting widgets. That way,
all the sanity checks that the existing functions have are applied for this code
as well.

I just spent half an hour tracking down a bug where a boolean ended up as a
"widget" in a fixed layout. The symptom was that while drawing the widget, an
error happened. Via this change, the error would instead be flagged while
constructing the widget.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 13:55:34 +01:00
Uli Schlachter a2301ae8f3 Add and use luaA_pushscreen()
Even when a screen is just an integer, the code becomes a bit more
self-documenting. Even better, if we start to handle screen objects to Lua
instead of screen indicies, there will only be one place that needs to be
changed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-27 10:57:07 +01:00
Uli Schlachter f02b75f826 Fix arguments to luaL_checkstack()
The argument to luaL_checkstack() is the amount of new stack to make available,
not the new size of the stack. Thus, remove the addition of lua_gettop(L) here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 19:07:06 +01:00
Uli Schlachter 2209f58e5d Balance the stack in luaA_loadrc()
In various conditions, luaA_loadrc() left luaA_dofunction_on_error and an error
message on the Lua stack. Also, it used LUA_MULTRET without looking at the
return values. Fix all of this and reorder the code a bit to make it easier to
follow.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 19:03:48 +01:00
Uli Schlachter 9eab892124 Fix unbalance Lua stack usage in event_handle_leavenotify()
Commit 42e0081958 removed a call to lua_pop(L,1) that was still necessary.
This commit adds that call again.

Fixes: https://github.com/awesomeWM/awesome/issues/703
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 18:52:35 +01:00
Uli Schlachter 68691ff818 Check that the Lua stack is empty in the main loop
The Lua stack is a finite resource and everything that pushes something there
should also clean up. This is not a problem for functions that are called by
Lua, because their "stack frame" is freed when they return. However, in global
context, Lua does not and cannot automatically clean up for us. Thus, it makes
sense to print a warning in this case.

(Additionally, this cleans up the stack if something is left)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 18:40:01 +01:00
Daniel Hahler a6dd6b4a20 Merge pull request #676 from psychon/luacheck
Luacheck
2016-02-17 17:15:08 +01:00
Daniel Hahler 1bd2838205 Merge pull request #701 from psychon/client-gravity-fullscreen
Fix awful.ewmh to handle window gravities
2016-02-17 17:14:51 +01:00
Uli Schlachter 43dba09c28 Add& use Luacheck support
This commit adds a new "luacheck" target to the Makefiles. This target is
automatically included in "make check" when luacheck is found in $PATH.
Additionally, this includes luacheck in Travis so that the build fails when
luacheck complains about something.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-16 19:45:10 +01:00
Uli Schlachter 267ab282b2 Sanitize argument handling for wibox.layout.stack constructor
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-16 19:42:35 +01:00
Uli Schlachter 976b03f8a7 Don't modify WM_HINTS in client_set_urgent()
To quote from ICCCM (§4.1.2): "The window manager will not change properties
written by the client."

We tried to do this anyway to update WM_HINTS so that the current urgency state
is reflected. Apparently, Chrome does a similar read-modify-set cycle and the
resulting race condition meant that the "accepts input" hint on Chromium's
window was permanently disabled.

This helps with https://github.com/awesomeWM/awesome/issues/670, but I still
think that Chrome shouldn't try to implement "please don't focus me when I do
the following" by temporarily claiming "please don't ever focus me".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-16 19:31:20 +01:00
Daniel Hahler 796c2fba51 Merge pull request #695 from psychon/fix-bugs-luacheck-found
Fix bugs luacheck found
2016-02-16 01:03:59 +01:00
Daniel Hahler bbab321314 Merge pull request #702 from psychon/fix-test-urgent
Fix test-urgent.lua
2016-02-16 01:03:37 +01:00
Daniel Hahler 9257c96b7c Merge pull request #690 from psychon/make-test-runner-more-robust
Make the functional test runner more robust
2016-02-16 01:03:06 +01:00
Daniel Hahler ff46d33f7c Merge pull request #700 from psychon/lua-compat
Travis: Lua 5.3: Disable Lua 5.2 compatibility
2016-02-16 01:02:50 +01:00
Uli Schlachter e5d3b2a25c Fix test-urgent.lua
Step 1 starts a client and uses awful.rules to move it to a not-selected tag.
Because this rule still has focus=true, this calls awful.ewmh.activate() via the
request::activate signal. This function makes the client urgent because it is on
a not-selected tag.

Step 3 does the same thing, but also uses switchtotag=true. Now
awful.ewmh.activate() doesn't make the client urgent because it successfully
focused this client. However, the test was wrongly assuming that the client
became urgent (copy&paste error? I don't know).

The fix is of course not to require the client to become urgent.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-15 22:09:10 +01:00
Uli Schlachter 4b9584fdb1 Fix awful.ewmh to handle window gravities
Since commit b2aaefd095, we correctly handle window gravities when
the border width of a client changes. Since most windows out there have a
NorthWest gravity, this means that most windows do not have this problem.
However, e.g. mplayer uses gravity "Static" and this causes this issue (any
gravity other than NorthWest will do).

This affects the fullscreen handling in awful.ewmh. The code has to set the
border width before it changes a client's geometry so that the move when the
border width changes doesn't matter.

No new integration test for this since I didn't find anything usable with a
non-NorthWest gravity. A test would be easy to write, just test if `c.fullscreen
= true ; c.fullscreen = false` restores the previous window geometry.

Fixes: https://github.com/awesomeWM/awesome/issues/697
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-15 21:35:28 +01:00
Uli Schlachter 029a6a18b0 Lua 5.3: Disable Lua 5.2 compatibility
Lua 5.3's build system provides the LUA_COMPAT_5_2 and LUA_COMPAT_5_1 defines to
enable some compatibility with these older Lua versions. LUA_COMPAT_5_2 is
defined by default while LUA_COMPAT_5_1 is not.

This commit also disables LUA_COMPAT_5_2 on the Lua version that we build on
Travis so that the build will hopefully break if some feature is used that was
removed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-15 20:51:52 +01:00
Uli Schlachter 8802560c4a Merge pull request #698 from actionless/fix-awful-prompt-after-luacheck
fix(awful: prompt): fix variable name after luacheck fixup
2016-02-15 10:03:41 +01:00
actionless d462e10790 fix(awful: prompt): fix variable name after luacheck fixup 2016-02-15 02:00:39 +01:00
Uli Schlachter 426da4f8bb Fix one more luacheck warning in awful.widget.tasklist 2016-02-14 14:43:20 +01:00
Uli Schlachter 798be638d9 Fix this master fill policy stuff
awful.layout.suit.corner does awful.tag.getmfpol(t), but doesn't actually have a
variable t in scope. I just copied the needed stuff from the tile layout.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:43:10 +01:00
Uli Schlachter b4148f5dfa Mark a bug in awful.widget.common as such
No idea what the correct value for this argument is supposed to be, but since
there is no variable "m" in scope, this always uses nil as the value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:43:04 +01:00
Uli Schlachter c7aed3bd88 Fix wrong variable in awful.widget.taglist
There is no "s" variable. This code wants "screen" instead. The effect of this
typo was that with multiple taglists, only the one that was created last got
updated.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:58 +01:00
Uli Schlachter b01f480431 awful.prompt: Fix with newer Lua
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:53 +01:00
Uli Schlachter ee530a65d6 Fix typo in awful.tag.swap
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:48 +01:00
Uli Schlachter a4e598d444 Fix naughty.reset_timeout
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:40 +01:00
Uli Schlachter 9db539fbf2 Fix wibox.layout.mirror
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-14 14:42:34 +01:00
Uli Schlachter 065dd0d213 Merge branch 'easy-async-spawn' of https://github.com/actionless/awesome 2016-02-14 14:34:37 +01:00
Uli Schlachter 1ea3ba6f30 Merge branch 'fix-images-in-doc' of https://github.com/awesomeWM/awesome 2016-02-14 14:33:51 +01:00
Uli Schlachter 99ef5822b0 Merge branch 'more-luacheck-fixes' of https://github.com/psychon/awesome 2016-02-14 14:33:06 +01:00
Uli Schlachter 191991d026 Merge branch 'coveralls' of https://github.com/psychon/awesome 2016-02-14 14:32:42 +01:00
Uli Schlachter b73ebabbfa Merge branch 'remove-awful-mouse-finder' of https://github.com/psychon/awesome 2016-02-14 14:32:28 +01:00
Daniel Hahler 10ff22a75d Merge pull request #693 from psychon/enable-titlebars-by-default
Enable titlebars by default
2016-02-13 15:09:21 +01:00
Uli Schlachter 3bc8aa2d40 Fix images in the documentation
Instead of copying images to ${BUILD_DIR}/docs/images, which is the directory
with the input to ldoc, this now copies the images to ${BUILD_DIR}/doc/images,
which is where ldoc generates its output. That way, the images are together with
the html files and are automatically picked up by a lot of stuff.

Fixes: https://github.com/awesomeWM/awesome/issues/681
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-13 08:04:14 +01:00
Uli Schlachter f87da55dfc Make the functional test runner more robust
Currently, an error in the default config in the right place isn't noticed. Fix
this by doing two things:

- Also grep for "error" (this catches runtime errors with a stack trace)
- Make _runner print a "success" message at the end and also grep for that

Fixes: https://github.com/awesomeWM/awesome/issues/689
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-13 07:36:59 +01:00
Emmanuel Lepage Vallée 0a15ea9131 Merge pull request #691 from psychon/fix-titlebars
Fix missing import from commit 7842f92f08
2016-02-12 21:36:42 -05:00
Daniel Hahler de3d97fb0d Merge pull request #682 from actionless/vim-bindings-improvements
chore(awful: hotkeys: vim): small improvements in hotkeys descriptions
2016-02-12 23:00:26 +01:00
Uli Schlachter f2b6f5835e Enable titlebars by default
This means that titlebars, which are an important feature, get more testing. As
was recently shown, they don't get enough testing currently. Also, new users
will likely expect titlebars these days.

Everyone who doesn't want titlebars can easily disable them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 18:33:53 +01:00
Uli Schlachter a0d4d729d3 Remove awful.mouse.finder
This module is partly broken since 2009 (the way to use it that is mentioned in
the docs doesn't actually work) because the mousefinder object doesn't have a
find()-method (the line doing "self.find = find" should do "self.finder =
finder.find"). Since no one really noticed, this module is apparently not used
much.

When someone wants to still use this, they are free to copy this to their own
config. It's not much code, but it's enough code that I am annoyed that we ship
something broken to users. Everyone who copies it to their own config will make
sure it works the way they want.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 18:27:40 +01:00
Uli Schlachter 6a4df17e70 Fix missing import from commit 7842f92f08
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 18:19:22 +01:00
Uli Schlachter 432908dd26 Fix test-leak-client.lua under LuaCov
Both the test runner and the wibox use gears.timer.delayed_call(). The test
runner uses this to call steps and the wibox uses it to trigger redraws. When
running under LuaCov, the Lua code becomes slow enough that the wibox didn't
redraw yet when the leak check is run. This causes the check to fail, because
the client is still referenced by the tasklist and thus cannot be garbage
collected.

Fix this by waiting one more iteration before running the leak check.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:26:29 +01:00
Uli Schlachter 9e05ff63ce Code coverage: Also consider functional tests
Lots of our code depends on the C API and thus can only be tested when that is
available. Hence, it makes sense to also run the functional tests under LuaCov.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:26:29 +01:00
Uli Schlachter b823dd4ed4 Add code coverage support
This uses coveralls.io and integrates the collection of coverage information
with Travis.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:26:07 +01:00
Uli Schlachter 2c77f9dcf8 Fix luacheck warnings in lib/naughty
A warning pointing out an actual problem is left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:16:42 +01:00
Uli Schlachter 15e72fb037 Fix luacheck warnings in lib/wibox
Warnings pointing out actual problems are left.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:15:55 +01:00
Uli Schlachter bf3b9b5f42 tests: Fix luacheck warnings
This leaves one warning in tests/test-urgent.lua which points out an actual
bug/problem.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:12:41 +01:00
Uli Schlachter 8c26e2dab4 Fix all luacheck warnings in lib/gears
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-12 09:11:50 +01:00
actionless 2501f128e4 chore(awful: hotkeys: vim): rename key groups 2016-02-12 01:07:04 +01:00