mirror of
https://github.com/glfw/glfw.git
synced 2025-10-03 13:20:58 +00:00
Wayland: Fix window hiding
Corrects the protocol violation with attaching an xdg_surface to a wl_surface that already has a buffer. Fixes #1492
This commit is contained in:
parent
49dbcfcb8c
commit
1a92f92762
@ -119,6 +119,7 @@ information on what to include when reporting a bug.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
- [Wayland] Bugfix: Window hiding not working (#1492)
|
||||||
- Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
|
- Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`,
|
||||||
`GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
|
`GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427)
|
||||||
- Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
|
- Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427)
|
||||||
@ -271,6 +272,7 @@ skills.
|
|||||||
- Siavash Eliasi
|
- Siavash Eliasi
|
||||||
- Felipe Ferreira
|
- Felipe Ferreira
|
||||||
- Michael Fogleman
|
- Michael Fogleman
|
||||||
|
- Jason Francis
|
||||||
- Gerald Franz
|
- Gerald Franz
|
||||||
- Mário Freitas
|
- Mário Freitas
|
||||||
- GeO4d
|
- GeO4d
|
||||||
|
@ -566,7 +566,7 @@ GLFWbool _glfwRefreshContextAttribs(_GLFWwindow* window,
|
|||||||
|
|
||||||
// Clearing the front buffer to black to avoid garbage pixels left over from
|
// Clearing the front buffer to black to avoid garbage pixels left over from
|
||||||
// previous uses of our bit of VRAM
|
// previous uses of our bit of VRAM
|
||||||
{
|
if (_glfwPlatformWindowVisible(window)) {
|
||||||
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
|
||||||
window->context.getProcAddress("glClear");
|
window->context.getProcAddress("glClear");
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
@ -221,7 +221,7 @@ static void makeContextCurrentEGL(_GLFWwindow* window)
|
|||||||
_glfwPlatformSetTls(&_glfw.contextSlot, window);
|
_glfwPlatformSetTls(&_glfw.contextSlot, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void swapBuffersEGL(_GLFWwindow* window)
|
void swapBuffersEGL(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
|
if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
|
||||||
{
|
{
|
||||||
|
@ -777,6 +777,14 @@ static void handleEvents(int timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void swapBuffersEGL(_GLFWwindow* window);
|
||||||
|
|
||||||
|
static void swapBuffersWL(_GLFWwindow* window)
|
||||||
|
{
|
||||||
|
if (window->wl.visible)
|
||||||
|
swapBuffersEGL(window);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW platform API //////
|
////// GLFW platform API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -800,6 +808,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
window->context.swapBuffers = swapBuffersWL;
|
||||||
}
|
}
|
||||||
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API)
|
||||||
{
|
{
|
||||||
@ -813,11 +822,12 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
if (wndconfig->title)
|
if (wndconfig->title)
|
||||||
window->wl.title = _glfw_strdup(wndconfig->title);
|
window->wl.title = _glfw_strdup(wndconfig->title);
|
||||||
|
|
||||||
if (wndconfig->visible)
|
|
||||||
{
|
|
||||||
if (!createXdgSurface(window))
|
if (!createXdgSurface(window))
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
|
||||||
|
if (wndconfig->visible)
|
||||||
|
{
|
||||||
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1019,21 +1029,18 @@ void _glfwPlatformShowWindow(_GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
if (!window->wl.visible)
|
if (!window->wl.visible)
|
||||||
{
|
{
|
||||||
createXdgSurface(window);
|
|
||||||
window->wl.visible = GLFW_TRUE;
|
window->wl.visible = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
void _glfwPlatformHideWindow(_GLFWwindow* window)
|
||||||
{
|
{
|
||||||
if (window->wl.xdg.toplevel)
|
if (window->wl.visible)
|
||||||
{
|
{
|
||||||
xdg_toplevel_destroy(window->wl.xdg.toplevel);
|
wl_surface_attach(window->wl.surface, NULL, 0, 0);
|
||||||
xdg_surface_destroy(window->wl.xdg.surface);
|
wl_surface_commit(window->wl.surface);
|
||||||
window->wl.xdg.toplevel = NULL;
|
|
||||||
window->wl.xdg.surface = NULL;
|
|
||||||
}
|
|
||||||
window->wl.visible = GLFW_FALSE;
|
window->wl.visible = GLFW_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
void _glfwPlatformRequestWindowAttention(_GLFWwindow* window)
|
||||||
|
Loading…
Reference in New Issue
Block a user