mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 00:33:24 +00:00
Merge 5a84bf67ad into dbadda2683
This commit is contained in:
commit
051de33160
@ -148,6 +148,8 @@ information on what to include when reporting a bug.
|
|||||||
potential segmentation fault (#2744)
|
potential segmentation fault (#2744)
|
||||||
- [Wayland] Bugfix: Confining or disabling the cursor could segfault on
|
- [Wayland] Bugfix: Confining or disabling the cursor could segfault on
|
||||||
compositors without `pointer-constraints-unstable-v1`
|
compositors without `pointer-constraints-unstable-v1`
|
||||||
|
- [Wayland] Bugfix: Events being lost due to some drivers moving events
|
||||||
|
to the default event queue during buffer swapping (#2793)
|
||||||
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
- [X11] Bugfix: Running without a WM could trigger an assert (#2593,#2601,#2631)
|
||||||
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
- [X11] Bugfix: Occasional crash when an idle display awakes (#2766)
|
||||||
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
- [X11] Bugfix: Prevent BadWindow when creating small windows with a content scale
|
||||||
|
|||||||
@ -1356,6 +1356,7 @@ static void handleEvents(double* timeout)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLFWbool event = GLFW_FALSE;
|
GLFWbool event = GLFW_FALSE;
|
||||||
|
GLFWbool wlcanread = GLFW_FALSE;
|
||||||
enum { DISPLAY_FD, KEYREPEAT_FD, CURSOR_FD, LIBDECOR_FD };
|
enum { DISPLAY_FD, KEYREPEAT_FD, CURSOR_FD, LIBDECOR_FD };
|
||||||
struct pollfd fds[] =
|
struct pollfd fds[] =
|
||||||
{
|
{
|
||||||
@ -1370,12 +1371,25 @@ static void handleEvents(double* timeout)
|
|||||||
|
|
||||||
while (!event)
|
while (!event)
|
||||||
{
|
{
|
||||||
while (wl_display_prepare_read(_glfw.wl.display) != 0)
|
wlcanread = GLFW_FALSE;
|
||||||
|
while (!wlcanread && !event)
|
||||||
{
|
{
|
||||||
if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
|
if (wl_display_prepare_read(_glfw.wl.display) == 0)
|
||||||
return;
|
{
|
||||||
|
wlcanread = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
else if (wl_display_dispatch_pending(_glfw.wl.display) > 0)
|
||||||
|
{
|
||||||
|
event = GLFW_TRUE;
|
||||||
|
if (wl_display_prepare_read(_glfw.wl.display) == 0)
|
||||||
|
{
|
||||||
|
wlcanread = GLFW_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wlcanread)
|
||||||
|
{
|
||||||
// If an error other than EAGAIN happens, we have likely been disconnected
|
// If an error other than EAGAIN happens, we have likely been disconnected
|
||||||
// from the Wayland session; try to handle that the best we can.
|
// from the Wayland session; try to handle that the best we can.
|
||||||
if (!flushDisplay())
|
if (!flushDisplay())
|
||||||
@ -1392,7 +1406,12 @@ static void handleEvents(double* timeout)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
|
double* ptimeout = timeout;
|
||||||
|
double notimeout = 0.0;
|
||||||
|
if (event)
|
||||||
|
ptimeout = ¬imeout; // do not wait if we already have an event
|
||||||
|
|
||||||
|
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), ptimeout))
|
||||||
{
|
{
|
||||||
wl_display_cancel_read(_glfw.wl.display);
|
wl_display_cancel_read(_glfw.wl.display);
|
||||||
return;
|
return;
|
||||||
@ -1406,6 +1425,16 @@ static void handleEvents(double* timeout)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
wl_display_cancel_read(_glfw.wl.display);
|
wl_display_cancel_read(_glfw.wl.display);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fds[DISPLAY_FD].fd = -1; // ignore wl events
|
||||||
|
double notimeout = 0.0;
|
||||||
|
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), ¬imeout))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fds[KEYREPEAT_FD].revents & POLLIN)
|
if (fds[KEYREPEAT_FD].revents & POLLIN)
|
||||||
{
|
{
|
||||||
@ -1427,7 +1456,6 @@ static void handleEvents(double* timeout)
|
|||||||
|
|
||||||
event = GLFW_TRUE;
|
event = GLFW_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user