diff options
| author | Stenzek <stenzek@users.noreply.github.com> | 2018-10-24 14:51:21 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-24 14:51:21 +1100 |
| commit | c4d1e4adffcd380cc87b841069ce2fe8b62d7b60 (patch) | |
| tree | c61a0a07c14ccc3c1f7247bdcc82927a82c145bb /Source/Core/DolphinNoGUI/MainNoGUI.cpp | |
| parent | 9c9d598ec006527bc47aea306e5171d03c12c5f5 (diff) | |
| parent | 2c6d96433c322b50470705d43005fd6308506d49 (diff) | |
Merge pull request #7450 from stenzek/glcontext
GLInterface refactoring/cleanup and runtime platform selection
Diffstat (limited to 'Source/Core/DolphinNoGUI/MainNoGUI.cpp')
| -rw-r--r-- | Source/Core/DolphinNoGUI/MainNoGUI.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index 5097b1b8f9..6cd71bd353 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -71,6 +71,10 @@ public: } virtual void Shutdown() {} virtual ~Platform() {} + + virtual WindowSystemType GetWindowSystem() const { return WindowSystemType::Headless; } + virtual void* GetDisplayHandle() const { return nullptr; } + virtual void* GetWindowHandle() const { return nullptr; } }; static Platform* platform; @@ -91,12 +95,6 @@ void Host_Message(HostMessageID id) updateMainFrameEvent.Set(); } -static void* s_window_handle = nullptr; -void* Host_GetRenderHandle() -{ - return s_window_handle; -} - void Host_UpdateTitle(const std::string& title) { platform->SetTitle(title); @@ -187,7 +185,6 @@ class PlatformX11 : public Platform } XMapRaised(dpy, win); XFlush(dpy); - s_window_handle = (void*)win; if (SConfig::GetInstance().bDisableScreenSaver) X11Utils::InhibitScreensaver(win, true); @@ -213,9 +210,6 @@ class PlatformX11 : public Platform void MainLoop() override { bool fullscreen = SConfig::GetInstance().bFullscreen; - int last_window_width = SConfig::GetInstance().iRenderWindowWidth; - int last_window_height = SConfig::GetInstance().iRenderWindowHeight; - if (fullscreen) { rendererIsFullscreen = X11Utils::ToggleFullscreen(dpy, win); @@ -315,14 +309,8 @@ class PlatformX11 : public Platform break; case ConfigureNotify: { - if (last_window_width != event.xconfigure.width || - last_window_height != event.xconfigure.height) - { - last_window_width = event.xconfigure.width; - last_window_height = event.xconfigure.height; - if (g_renderer) - g_renderer->ResizeSurface(last_window_width, last_window_height); - } + if (g_renderer) + g_renderer->ResizeSurface(); } break; } @@ -354,6 +342,10 @@ class PlatformX11 : public Platform XCloseDisplay(dpy); } + + WindowSystemType GetWindowSystem() const override { return WindowSystemType::X11; } + void* GetDisplayHandle() const override { return static_cast<void*>(dpy); } + void* GetWindowHandle() const override { return reinterpret_cast<void*>(win); } }; #endif @@ -433,7 +425,10 @@ int main(int argc, char* argv[]) DolphinAnalytics::Instance()->ReportDolphinStart("nogui"); - if (!BootManager::BootCore(std::move(boot))) + WindowSystemInfo wsi(platform->GetWindowSystem(), platform->GetDisplayHandle(), + platform->GetWindowHandle()); + + if (!BootManager::BootCore(std::move(boot), wsi)) { fprintf(stderr, "Could not boot the specified file\n"); return 1; |
