UI/AppKit: Register socket notifiers in the common run loop mode

When the user resizes the browser window, AppKit will spin the current
run loop in the common mode. This patch allows socket events from IPC to
be processed while the resize is ongoing. This includes the WebView hook
to repaint.

Co-Authored-By: Andreas Kling <andreas@ladybird.org>
This commit is contained in:
Timothy Flynn 2024-11-08 13:27:10 -05:00 committed by Tim Flynn
commit 3bbe1b0c62
Notes: github-actions[bot] 2024-11-08 20:32:10 +00:00

View file

@ -294,7 +294,7 @@ void CFEventLoopManager::register_notifier(Core::Notifier& notifier)
CFSocketSetSocketFlags(socket, sockopt);
auto* source = CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes);
CFRelease(socket);
@ -304,7 +304,7 @@ void CFEventLoopManager::register_notifier(Core::Notifier& notifier)
void CFEventLoopManager::unregister_notifier(Core::Notifier& notifier)
{
if (auto source = ThreadData::the().notifiers.take(&notifier); source.has_value()) {
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), *source, kCFRunLoopDefaultMode);
CFRunLoopRemoveSource(CFRunLoopGetCurrent(), *source, kCFRunLoopCommonModes);
CFRelease(*source);
}
}