vibe-d / eventcore

High performance proactor event loop abstraction library
MIT License
60 stars 42 forks source link

MsgWaitForMultipleObjectsEx wake mask #233

Closed vladimmi closed 5 months ago

vladimmi commented 6 months ago

Potentially noob question: is there any particular reason why is QS_ALLEVENT used?

I was trying to use vibe.d with WebView2. Basically following Win32 examples of WebView2 but using vibe's runApplication instead of manual loop with GetMessage, TranslateMessage, DispatchMessage. It works in general but with a weird thing: webview does not respond to mouse input until I, for example, move mouse to window border - at that moment all previous input is processed and become visible (like text selection). It seems that event loop sits in MsgWaitForMultipleObjectsEx and is not notified about activity in webview when in fact it's already waiting in queue. That's related to webview threading model and usage of message queue, I guess?..

Quick test with SetTimer from winapi makes window responsive - event loop frequently receives timer event and with that also processes that input with PeekMessage. But it's an ugly workaround.

A bit deeper research shows that using QS_ALLINPUT instead of QS_ALLEVENT also fixes the issue - according to docs, the difference is additional QS_SENDMESSAGE only.

s-ludwig commented 6 months ago

QS_ALLINPUT sounds like the right call. I'm not sure why it is QS_ALLEVENT instead, probably it was just an oversight and nobody has noticed it so far.

s-ludwig commented 5 months ago

Fixed by #237.