mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-10 13:04:03 +03:00
Ensure queued display events are dispatched when polling/waiting for events
This commit is contained in:
parent
31853ee20c
commit
55556aaac4
5
glfw/wl_window.c
vendored
5
glfw/wl_window.c
vendored
@ -1163,16 +1163,19 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
|
||||
|
||||
void _glfwPlatformPollEvents(void)
|
||||
{
|
||||
wl_display_dispatch_pending(_glfw.wl.display);
|
||||
handleEvents(0);
|
||||
}
|
||||
|
||||
void _glfwPlatformWaitEvents(void)
|
||||
{
|
||||
handleEvents(-1);
|
||||
double timeout = wl_display_dispatch_pending(_glfw.wl.display) > 0 ? 0 : -1;
|
||||
handleEvents(timeout);
|
||||
}
|
||||
|
||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||
{
|
||||
if (wl_display_dispatch_pending(_glfw.wl.display) > 0) timeout = 0;
|
||||
handleEvents(timeout);
|
||||
}
|
||||
|
||||
|
13
glfw/x11_window.c
vendored
13
glfw/x11_window.c
vendored
@ -54,7 +54,7 @@
|
||||
// This avoids blocking other threads via the per-display Xlib lock that also
|
||||
// covers GLX functions
|
||||
//
|
||||
void _glfwDispatchX11Events(void);
|
||||
GLFWbool _glfwDispatchX11Events(void);
|
||||
|
||||
static void
|
||||
handleEvents(double timeout) {
|
||||
@ -2543,8 +2543,10 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
|
||||
PropModeReplace, (unsigned char*) &value, 1);
|
||||
}
|
||||
|
||||
void _glfwDispatchX11Events(void) {
|
||||
GLFWbool
|
||||
_glfwDispatchX11Events(void) {
|
||||
_GLFWwindow* window;
|
||||
GLFWbool dispatched = GLFW_FALSE;
|
||||
|
||||
#if defined(__linux__)
|
||||
_glfwDetectJoystickConnectionLinux();
|
||||
@ -2556,6 +2558,7 @@ void _glfwDispatchX11Events(void) {
|
||||
XEvent event;
|
||||
XNextEvent(_glfw.x11.display, &event);
|
||||
processEvent(&event);
|
||||
dispatched = GLFW_TRUE;
|
||||
}
|
||||
|
||||
window = _glfw.x11.disabledCursorWindow;
|
||||
@ -2574,20 +2577,24 @@ void _glfwDispatchX11Events(void) {
|
||||
}
|
||||
|
||||
XFlush(_glfw.x11.display);
|
||||
return dispatched;
|
||||
}
|
||||
|
||||
void _glfwPlatformPollEvents(void)
|
||||
{
|
||||
_glfwDispatchX11Events();
|
||||
handleEvents(0);
|
||||
}
|
||||
|
||||
void _glfwPlatformWaitEvents(void)
|
||||
{
|
||||
handleEvents(-1);
|
||||
double timeout = _glfwDispatchX11Events() ? 0 : -1;
|
||||
handleEvents(timeout);
|
||||
}
|
||||
|
||||
void _glfwPlatformWaitEventsTimeout(double timeout)
|
||||
{
|
||||
if (_glfwDispatchX11Events()) timeout = 0;
|
||||
handleEvents(timeout);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user