command: add write_watch_later_config command

Closes #808.

Signed-off-by: wm4 <wm4@nowhere>
lua: fix compilation with lua 5.2

Commit e2e450f9 started making use of luaL_register(), but OF COURSE
this function disappeared in Lua 5.2, and was replaced with a 5.2-only
alternative, slightly different mechanism.

So just NIH our own function. This is actually slightly more correct,
since it forces the user to call "require" to actually make the module
visible for builtin C-only modules other than "mp". Fix autoload.lua
accordingly.
lua: add missing include files

These are actually already included in osdep/io.h, but I think it's
cleaner to repeat them in the file where they are actually needed.
(osdep/io.h needs to have them for other reasons.)
input: make combined commands repeatable

Binding multiple commands at once where always considered not
repeatable, because the MP_CMD_COMMAND_LIST wasn't considered
repeatable.

Fixes #807 (probably).
x11: fix datatype for _NET_WM_PID

Setting this property was added 12 years ago, and the code was always
incorrect. The underlying data type is "long", not "pid_t". It's well
possible that the data types are different, and the pointer to the pid
variable is directly passed to XChangeProperty, possibly invoking
undefined behavior.

It's funny, because in theory using pid_t for PIDs sounds more correct.
x11: fix restoring position when leaving fullscreen

Accidentally broken in commit 7163bf7d by inverting the condition.