Fix up eglSwapBuffers and add eglSwapBuffersWithDamageEXT

This series contains a couple of different fixes for the wayland client-side implementation to make it better follow the spec (see individual commit messages for deatils).  The last patch implements the EGL_EXT_swap_buffers_with_damage extension for the wayland platform.