grawity/gale/liboop - changes taken from https://github.com/grawity/gale/commit/22ceb912292158885240bda94fb92cfa43317f37 - https://github.com/grawity/gale/commit/46e485462c9d55c0983d976e624cdd75914517fd - and https://github.com/grawity/gale/commit/56398124fa4bd4bbb1d61bd666442147f303a9e8