diff options
| author | Scott Moreau <oreaus@gmail.com> | 2014-01-19 09:11:07 -0700 |
|---|---|---|
| committer | Scott Moreau <oreaus@gmail.com> | 2014-01-19 10:36:20 -0700 |
| commit | 84aa98a5a4587629d6fa2bc9b3b07a5432c2e131 (patch) | |
| tree | e62a8f2ff2a0d6be51496f61a7e3622c1ad7f5b0 /Source/Core/DolphinWX/MainNoGUI.cpp | |
| parent | 3b25bf2f14189d74cd7dd00b32d8b20b9df3e024 (diff) | |
wayland: Add bits required to run as a wayland client.
Diffstat (limited to 'Source/Core/DolphinWX/MainNoGUI.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/MainNoGUI.cpp | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index c9e61b46f7..49ac423415 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -10,12 +10,17 @@ #include "Common.h" #include "FileUtil.h" -#if defined HAVE_X11 && HAVE_X11 +#if HAVE_X11 #include <X11/keysym.h> #include "State.h" #include "X11Utils.h" #endif +#if HAVE_WAYLAND +#include <wayland-client.h> +#include "GLInterface/Platform.h" +#endif + #ifdef __APPLE__ #import <Cocoa/Cocoa.h> #endif @@ -122,7 +127,7 @@ void Host_SysMessage(const char *fmt, ...) void Host_SetWiiMoteConnectionState(int _State) {} -#if defined(HAVE_X11) && HAVE_X11 +#if HAVE_X11 void X11_MainLoop() { bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen; @@ -256,6 +261,23 @@ void X11_MainLoop() } #endif +#if HAVE_WAYLAND +void Wayland_MainLoop() +{ + // Wait for display to be initialized + while(!GLWin.wl_display) + usleep(20000); + + GLWin.running = 1; + + while (GLWin.running) + wl_display_dispatch(GLWin.wl_display); + + if (GLWin.wl_display) + wl_display_disconnect(GLWin.wl_display); +} +#endif + int main(int argc, char* argv[]) { #ifdef __APPLE__ @@ -304,9 +326,34 @@ int main(int argc, char* argv[]) m_LocalCoreStartupParameter.m_strVideoBackend); WiimoteReal::LoadSettings(); +#if USE_EGL + GLWin.platform = EGL_PLATFORM_NONE; +#endif +#if HAVE_WAYLAND + GLWin.wl_display = NULL; +#endif + // No use running the loop when booting fails if (BootManager::BootCore(argv[optind])) { +#if USE_EGL + while (GLWin.platform == EGL_PLATFORM_NONE) + usleep(20000); +#endif +#if HAVE_WAYLAND + if (GLWin.platform == EGL_PLATFORM_WAYLAND) + Wayland_MainLoop(); +#endif +#if HAVE_X11 +#if USE_EGL + if (GLWin.platform == EGL_PLATFORM_X11) { +#endif + XInitThreads(); + X11_MainLoop(); +#if USE_EGL + } +#endif +#endif #ifdef __APPLE__ while (running) { @@ -328,9 +375,6 @@ int main(int argc, char* argv[]) [event release]; [pool release]; -#elif defined HAVE_X11 && HAVE_X11 - XInitThreads(); - X11_MainLoop(); #else while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN) updateMainFrameEvent.Wait(); |
