When debuggin event loop display number of dispatched X11 events
This commit is contained in:
parent
1c4f5b471d
commit
a320e8bc25
21
glfw/x11_window.c
vendored
21
glfw/x11_window.c
vendored
@ -55,7 +55,7 @@
|
|||||||
// This avoids blocking other threads via the per-display Xlib lock that also
|
// This avoids blocking other threads via the per-display Xlib lock that also
|
||||||
// covers GLX functions
|
// covers GLX functions
|
||||||
//
|
//
|
||||||
GLFWbool _glfwDispatchX11Events(void);
|
static unsigned _glfwDispatchX11Events(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handleEvents(double timeout) {
|
handleEvents(double timeout) {
|
||||||
@ -63,8 +63,9 @@ handleEvents(double timeout) {
|
|||||||
int display_read_ok = pollForEvents(&_glfw.x11.eventLoopData, timeout);
|
int display_read_ok = pollForEvents(&_glfw.x11.eventLoopData, timeout);
|
||||||
EVDBG("display_read_ok: %d", display_read_ok);
|
EVDBG("display_read_ok: %d", display_read_ok);
|
||||||
if (display_read_ok) {
|
if (display_read_ok) {
|
||||||
_glfwDispatchX11Events();
|
unsigned dispatched = _glfwDispatchX11Events();
|
||||||
EVDBG("_glfwDispatchX11Events() done");
|
(void)dispatched;
|
||||||
|
EVDBG("dispatched %u X11 events", dispatched);
|
||||||
}
|
}
|
||||||
glfw_ibus_dispatch(&_glfw.x11.xkb.ibus);
|
glfw_ibus_dispatch(&_glfw.x11.xkb.ibus);
|
||||||
glfw_dbus_session_bus_dispatch();
|
glfw_dbus_session_bus_dispatch();
|
||||||
@ -2497,29 +2498,29 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
|
|||||||
PropModeReplace, (unsigned char*) &value, 1);
|
PropModeReplace, (unsigned char*) &value, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLFWbool
|
static inline unsigned
|
||||||
dispatch_x11_queued_events(void) {
|
dispatch_x11_queued_events(void) {
|
||||||
GLFWbool dispatched = GLFW_FALSE;
|
unsigned dispatched = 0;
|
||||||
while (XQLength(_glfw.x11.display) > 0)
|
while (XQLength(_glfw.x11.display) > 0)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
XNextEvent(_glfw.x11.display, &event);
|
XNextEvent(_glfw.x11.display, &event);
|
||||||
processEvent(&event);
|
processEvent(&event);
|
||||||
dispatched = GLFW_TRUE;
|
dispatched += 1;
|
||||||
}
|
}
|
||||||
return dispatched;
|
return dispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWbool
|
static unsigned
|
||||||
_glfwDispatchX11Events(void) {
|
_glfwDispatchX11Events(void) {
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
GLFWbool dispatched = GLFW_FALSE;
|
unsigned dispatched = 0;
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
_glfwDetectJoystickConnectionLinux();
|
_glfwDetectJoystickConnectionLinux();
|
||||||
#endif
|
#endif
|
||||||
XPending(_glfw.x11.display);
|
XPending(_glfw.x11.display);
|
||||||
if (dispatch_x11_queued_events()) dispatched = GLFW_TRUE;
|
dispatched += dispatch_x11_queued_events();
|
||||||
|
|
||||||
window = _glfw.x11.disabledCursorWindow;
|
window = _glfw.x11.disabledCursorWindow;
|
||||||
if (window)
|
if (window)
|
||||||
@ -2538,7 +2539,7 @@ _glfwDispatchX11Events(void) {
|
|||||||
|
|
||||||
XFlush(_glfw.x11.display);
|
XFlush(_glfw.x11.display);
|
||||||
// XFlush can cause events to be queued
|
// XFlush can cause events to be queued
|
||||||
if (dispatch_x11_queued_events()) dispatched = GLFW_TRUE;
|
dispatched += dispatch_x11_queued_events();
|
||||||
return dispatched;
|
return dispatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user