GL/Context: Better handle resizing with GLX

Fixes fullscreen having no effect when running under XWayland.
This commit is contained in:
Connor McLaughlin 2021-03-27 16:14:33 +10:00
parent 5df28eff9d
commit 47ba6e7449
2 changed files with 14 additions and 14 deletions

View File

@ -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<u32>(surface_width);
m_wi.surface_height = static_cast<u32>(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<u32>(surface_width);
m_wi.surface_height = static_cast<u32>(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;

View File

@ -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();
}