diff options
| author | Stenzek <stenzek@gmail.com> | 2016-11-19 23:03:20 +1000 |
|---|---|---|
| committer | Stenzek <stenzek@gmail.com> | 2016-11-19 23:03:20 +1000 |
| commit | 1aecf90765f2bb7c8acaf848cc71f05a26ef4de6 (patch) | |
| tree | 38bd16e8cc75787a8f784e28751be07d8b3f2ddc /Source/Core | |
| parent | 2a5d22b3a7c9ba4a67107cbdbe3cbea87c6a2af2 (diff) | |
DolphinNoGUI: Receive resize events and notify backend when this occurs
Solves the viewport sizing issue for backends that cannot tell when the
window is resized (Vulkan on NV at least).
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinWX/MainNoGUI.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp index b0c6e9a321..fee6e316c1 100644 --- a/Source/Core/DolphinWX/MainNoGUI.cpp +++ b/Source/Core/DolphinWX/MainNoGUI.cpp @@ -31,6 +31,7 @@ #include "UICommon/UICommon.h" +#include "VideoCommon/RenderBase.h" #include "VideoCommon/VideoBackendBase.h" static bool rendererHasFocus = true; @@ -188,7 +189,7 @@ class PlatformX11 : public Platform SConfig::GetInstance().iRenderWindowYPos, SConfig::GetInstance().iRenderWindowWidth, SConfig::GetInstance().iRenderWindowHeight, 0, 0, BlackPixel(dpy, 0)); - XSelectInput(dpy, win, KeyPressMask | FocusChangeMask); + XSelectInput(dpy, win, StructureNotifyMask | KeyPressMask | FocusChangeMask); Atom wmProtocols[1]; wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True); XSetWMProtocols(dpy, win, wmProtocols, 1); @@ -220,6 +221,8 @@ 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) { @@ -313,6 +316,22 @@ class PlatformX11 : public Platform if ((unsigned long)event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False)) s_shutdown_requested.Set(); 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; + + // We call Renderer::ChangeSurface here to indicate the size has changed, + // but pass the same window handle. This is needed for the Vulkan backend, + // otherwise it cannot tell that the window has been resized on some drivers. + if (g_renderer) + g_renderer->ChangeSurface(s_window_handle); + } + } + break; } } if (!fullscreen) |
