Merge pull request #743 from psychon/keygrabber-errors

Keygrabber errors
This commit is contained in:
Daniel Hahler 2016-03-07 00:25:35 +01:00
commit 9f5e6c3827
9 changed files with 35 additions and 12 deletions

10
event.c
View File

@ -122,10 +122,11 @@ event_handle_mousegrabber(int x, int y, uint16_t mask)
{
warn("Stopping mousegrabber.");
luaA_mousegrabber_stop(L);
} else {
if(!lua_isboolean(L, -1) || !lua_toboolean(L, -1))
luaA_mousegrabber_stop(L);
lua_pop(L, 1); /* pop returned value */
}
else if(!lua_isboolean(L, -1) || !lua_toboolean(L, -1))
luaA_mousegrabber_stop(L);
lua_pop(L, 1); /* pop returned value */
return true;
}
return false;
@ -660,12 +661,11 @@ event_handle_key(xcb_key_press_event_t *ev)
{
lua_rawgeti(L, LUA_REGISTRYINDEX, globalconf.keygrabber);
if(!luaA_dofunction(L, 3, 1))
if(!luaA_dofunction(L, 3, 0))
{
warn("Stopping keygrabber.");
luaA_keygrabber_stop(L);
}
lua_pop(L, 1);
}
}
else

View File

@ -16,6 +16,20 @@ runner.add_to_default_rules = function(r)
table.insert(awful.rules.rules, r)
end
-- Was the runner started already?
local running = false
-- This is used if a test causes errors before starting the runner
timer.start_new(1, function()
if not running then
io.stderr:write("Error: run_steps() was never called\n")
if not runner.quit_awesome_on_error then
io.stderr:write("Keeping awesome open...\n")
return -- keep awesome open on error.
end
awesome.quit()
end
end)
runner.run_steps = function(steps)
-- Setup timer/timeout to limit waiting for signal and quitting awesome.
@ -24,6 +38,8 @@ runner.run_steps = function(steps)
local wait=20
local step=1
local step_count=0
assert(not running, "run_steps() was called twice")
running = true
t:connect_signal("timeout", function() timer.delayed_call(function()
io.flush() -- for "tail -f".
step_count = step_count + 1

View File

@ -1,5 +1,6 @@
--- Test for awful.widget.watch
local runner = require("_runner")
local watch = require("awful.widget.watch")
local callbacks_done = 0
@ -25,6 +26,6 @@ local steps = {
end
end
}
require("_runner").run_steps(steps)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,6 +1,7 @@
-- Some benchmarks that aren't really tests, but are included here anyway so
-- that we notice if they break.
local runner = require("_runner")
local awful = require("awful")
local GLib = require("lgi").GLib
local create_wibox = require("_wibox_helper").create_wibox
@ -75,6 +76,6 @@ benchmark(relayout_textclock, "relayout textclock")
benchmark(redraw_textclock, "redraw textclock")
benchmark(e2e_tag_switch, "tag switch")
require("_runner").run_steps({ function() return true end })
runner.run_steps({ function() return true end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,6 +1,7 @@
--- Tests for focus signals / property.
-- Test for https://github.com/awesomeWM/awesome/issues/134.
local runner = require("_runner")
local awful = require("awful")
local beautiful = require("beautiful")
@ -44,6 +45,6 @@ local steps = {
end
}
require("_runner").run_steps(steps)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,4 +1,5 @@
-- Some memory leak checks involving clients as integration tests.
local runner = require("_runner")
local awful = require("awful")
local wibox = require("wibox")
@ -78,6 +79,6 @@ local steps = {
end,
}
require("_runner").run_steps(steps)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,5 +1,6 @@
-- Some memory leak checks as integration tests.
local runner = require("_runner")
local awful = require("awful")
local cairo = require("lgi").cairo
local create_wibox = require("_wibox_helper").create_wibox
@ -77,6 +78,6 @@ collectable(awful.widget.tasklist(1, awful.widget.tasklist.filter.currenttags))
prepare_for_collect = emit_refresh
collectable(create_wibox())
require("_runner").run_steps({ function() return true end })
runner.run_steps({ function() return true end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,5 +1,6 @@
--- Tests for spawn's startup notifications.
local runner = require("_runner")
local spawn = require("awful.spawn")
local manage_called, c_snid
@ -38,6 +39,6 @@ local steps = {
end
}
require("_runner").run_steps(steps)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1,5 +1,6 @@
--- Tests for spawn
local runner = require("_runner")
local spawn = require("awful.spawn")
local spawns_done = 0
@ -63,6 +64,6 @@ local steps = {
end,
}
require("_runner").run_steps(steps)
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80