Ensure we attempt to read wl_display each frame

Somewhat convoluted code needs reworking
This commit is contained in:
Doug Binks 2025-11-26 14:14:01 +00:00
parent 78c2e851b0
commit e917b77539

View File

@ -1381,6 +1381,10 @@ static void handleEvents(double* timeout)
else if (wl_display_dispatch_pending(_glfw.wl.display) > 0) else if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
{ {
event = GLFW_TRUE; event = GLFW_TRUE;
if (wl_display_prepare_read(_glfw.wl.display) == 0)
{
wlcanread = GLFW_TRUE;
}
} }
} }
@ -1402,7 +1406,16 @@ static void handleEvents(double* timeout)
return; return;
} }
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout)) if(event)
{
double notimeout = 0.0;
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), &notimeout))
{
wl_display_cancel_read(_glfw.wl.display);
return;
}
}
else if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
{ {
wl_display_cancel_read(_glfw.wl.display); wl_display_cancel_read(_glfw.wl.display);
return; return;
@ -1420,7 +1433,7 @@ static void handleEvents(double* timeout)
else else
{ {
fds[DISPLAY_FD].fd = -1; // ignore wl events fds[DISPLAY_FD].fd = -1; // ignore wl events
fds[LIBDECOR_FD].fd = -1; //fds[LIBDECOR_FD].fd = -1;
//fds[CURSOR_FD].fd = -1; //fds[CURSOR_FD].fd = -1;
double notimeout = 0.0; double notimeout = 0.0;
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), &notimeout)) if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), &notimeout))