I am sorry if you feel this topic should be in another forum. But since it's only in windows, I guess here may be a good place to ask for it.
So the thing is I have a DX12 application need to keep running even if you are moving the window or resizing the window. If your windows messaging handling is in your rendering thread, your render will be paused when you move or resize the window (may be block in DefWindowProc)
My first approach is separating render thread and have all event handling in UI thread. But some data shared by both thread cause sync issue like ImGuiIO: ImGui event handling need to be called before or after rendering, but since they are get called in separate thread, you have to sync both thread at some point, which seems not an ideal solution to me.
So later I tried another approach: using a separate render thread, and have UI thread post needed msg to render thread' message queue by calling PostThreadMessage. So this time event handling is in the same thread as render thread, which looks good. But there are big problems: my render thread may lost important message like WM_LBUTTONDOWN/UP etc. if UI thread posting faster than render thread can process... even if I let my UI thread wait for render thread's ready signal...
Another big issue for my second approach is that not any msg can be post on to other thread's message queue. For example I am using MSFT interactioncontext library which need to handle WM_POINTEXXX events and sadly those event cannot post on to other thread...
Having so much trouble separating UI thread I feel like I must did something fundamentally wrong, so I come here for help, how to properly separate UI thread?