The minimal application in Haiku has two thread/loopers. There is the BApplication one, and the BWindow one.
The BApplication usually has only itself as the single BHandler. The window looper has itself for window events, plus each BView added to it.
Messages are always targetted at a specific handler, and dispatched by the looper (which will eventually call MessageReceived on the proper handler).
The messages come from a port (there is one port for each looper). IsMessageWaiting allows to poll the port for pending messages. So, as long as IsMessageWaiting returns false, you can process your own things, but when it returns true, you should exit MessageReceived and give control back to the BLooper message handling loop. This is all at the BLooper level, IsMessageWaiting will tell you if there is a pending message targetted to any of the handlers for the current looper.
For window resize, make sure your view has the B_FRAME_EVENTS flag set if you want to get them. For mouse and keyboard events, they get only to the currently focused view (BView::MakeFocus) of the currently active window, unless you use SetMouseEventMask to force-grab the mouse.
B_MOUSE_IDLE is used to make tool-tips show after a delay, apparently.
Note that this kind of "own event loop" pattern is not really the expected use of the API. Normally an application would only reply to messages, and use a periodic message (Pulse() / B_PULSE_NEEDED, or a BMessageRunner, or some other thread watching on an external event) to perform background processing.