loader: Fix Wayland support

All that was needed was to fix some misplaced braces, fix a couple of
copy+paste problems from Mir, and add a lookup function.  Getting Mir
support working should be pretty easy.

Conflicts:
	layers/swapchain.cpp
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 120bf39..1434033 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@
     set(DisplayServer Android)
 elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
     #   TODO: Basic support is present for Xlib but is untested.
-    #         Wayland/Mir support is stubbed in but unimplemented and untested.
+    #         Mir support is stubbed in but unimplemented and untested.
     option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
     option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" OFF)
     option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" OFF)