Due to a Lua ""feature"", light userdatas all share the same metatable,
so setting individual ones for each event wasn't working very well. The
solution instead is to replace the light userdata pointer with a full
userdata with the event struct copied into it. This also means we can't
have window objects being presented in callbacks, but that's okay, I
think plugins should be using upvalues for that anyway.
Calculating strlen of a hard-coded stringat runtime, by iterating
through it until finding a 0 byte, is nothing but a waste of CPU cycles.
We already know the length, so let's just use it directly.
It's more resource-intensive, but all the plugins sharing one stack was
causing so many problems that I'm not sure it was even possible to do
correctly; Lua stacks are aggressively global, and all the plugins
sharing one set of global state was causing so many bugs, not to mention
safety issues of plugins potentially having access to each other, that
it's simply not worth the trouble.
Removes a lot of the mess and macro soup left over from when this file
was based on posix_spawn instead of fork exec. Notable changes:
- pass app.user.home to HDOS: makes fake_java.c a lot simpler
- no longer need to manipulate XDG_RUNTIME_DIR: fixes issues such as #19
- FindJava function: no longer relying on JAVA_HOME to be correct or on
/usr/bin/env to find java, fixes issues such as #24, #34
Previously the correct client would me destroyed but it wasn't
necessarily the correct one that would get removed from the list. It
seems to be that it was always the last one that would get removed. I'm
not sure why this was using a multiple-result search in the first place.