(SDL) Backport enygmata's SDL patches