(OSX) Refactor apple_gfx_ctx_swap_buffers for OSX