Refactor CGUIWindowManager::DispatchThreadMessages() to be a solid thread message dispatch and process method.

in CGUIWindowManager::DispatchThreadMessages(), copy to temp vector and loop method also be used, which will delay left messages in temp vector if SendMessage cause a modal dialog or something init another deeper message loop, then the left messages in temp vector will not be processed until the deeper message loop exit and SendMessage returned, then the messages will be processed delayed and not in order, result is unexpected.

I made a similar fix for it like https://github.com/xbmc/xbmc/pull/2167 but it seems has some limitation, so I refactor it under these rules:

As a thread message queue service, it should fulfill:
* Must: Thread safe, message can be pushed into queue in arbitrary thread context.
* Must: Messages be processed in dispatch message thread context with the same order as they be pushed into the queue.
* Must: Dispatch function support call itself during message process procedure, and do not break other rules listed here.
* Should: Message will be processed in next dispatch message call after it be pushed into the queue, then no deadlock.
* If possible: Queued messages can be removed by certain filter condition.

if we both agree above, then how to implement it should has free space as long as it's bug free, although it could be a little complex and not easy to understand.