From 47ba6e7449f3696745dd7c89b481c08a6f8ba3d5 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sat, 27 Mar 2021 16:14:33 +1000 Subject: [PATCH] GL/Context: Better handle resizing with GLX Fixes fullscreen having no effect when running under XWayland. --- src/common/gl/context_egl.cpp | 26 +++++++++++++------------- src/common/gl/context_glx.cpp | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/common/gl/context_egl.cpp b/src/common/gl/context_egl.cpp index 34da54ba9..b503a32b4 100644 --- a/src/common/gl/context_egl.cpp +++ b/src/common/gl/context_egl.cpp @@ -105,21 +105,21 @@ bool ContextEGL::ChangeSurface(const WindowInfo& new_wi) void ContextEGL::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/) { - // This seems to race on Android... -#ifndef ANDROID - EGLint surface_width, surface_height; - if (eglQuerySurface(m_display, m_surface, EGL_WIDTH, &surface_width) && - eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &surface_height)) + if (new_surface_width == 0 && new_surface_height == 0) { - m_wi.surface_width = static_cast(surface_width); - m_wi.surface_height = static_cast(surface_height); - return; + EGLint surface_width, surface_height; + if (eglQuerySurface(m_display, m_surface, EGL_WIDTH, &surface_width) && + eglQuerySurface(m_display, m_surface, EGL_HEIGHT, &surface_height)) + { + m_wi.surface_width = static_cast(surface_width); + m_wi.surface_height = static_cast(surface_height); + return; + } + else + { + Log_ErrorPrintf("eglQuerySurface() failed: %d", eglGetError()); + } } - else - { - Log_ErrorPrintf("eglQuerySurface() failed: %d", eglGetError()); - } -#endif m_wi.surface_width = new_surface_width; m_wi.surface_height = new_surface_height; diff --git a/src/common/gl/context_glx.cpp b/src/common/gl/context_glx.cpp index 464993a39..454e242d0 100644 --- a/src/common/gl/context_glx.cpp +++ b/src/common/gl/context_glx.cpp @@ -113,7 +113,7 @@ bool ContextGLX::ChangeSurface(const WindowInfo& new_wi) void ContextGLX::ResizeSurface(u32 new_surface_width /*= 0*/, u32 new_surface_height /*= 0*/) { - m_window.Resize(); + m_window.Resize(new_surface_width, new_surface_height); m_wi.surface_width = m_window.GetWidth(); m_wi.surface_height = m_window.GetHeight(); }