Linux: Fixed UI freeze when closing debugger tools while a tooltip is opened

Found on Fedora 42 using Wayland. An infinite loop occurred when XQueryPointer failed.
This commit is contained in:
Sour 2025-06-26 15:49:45 +09:00
parent 9808b0f2ca
commit 93f1da5c75
1 changed files with 18 additions and 5 deletions

View File

@ -34,14 +34,27 @@ SystemMouseState LinuxMouseManager::GetSystemMouseState(void* rendererHandle)
Window root = 0; Window root = 0;
Window c = 0; Window c = 0;
int rootX, rootY, childX, childY; int rootX = 0;
uint32_t mask; int rootY = 0;
int childX = 0;
int childY = 0;
uint32_t mask = 0;
XGrabServer(_display); XGrabServer(_display);
XQueryPointer(_display, _rootWindow, &root, &c, &rootX, &rootY, &childX, &childY, &mask); if(!XQueryPointer(_display, _rootWindow, &root, &c, &rootX, &rootY, &childX, &childY, &mask)) {
if(root != _rootWindow) c = root; XUngrabServer(_display);
XFlush(_display);
return state;
}
if(root != _rootWindow) {
c = root;
}
while(c != 0) { while(c != 0) {
XQueryPointer(_display, c, &root, &c, &rootX, &rootY, &childX, &childY, &mask); if(!XQueryPointer(_display, c, &root, &c, &rootX, &rootY, &childX, &childY, &mask)) {
break;
}
} }
XUngrabServer(_display); XUngrabServer(_display);
XFlush(_display); XFlush(_display);