r941: Fixes bug 340
http://bugs.cinelerra.org/show_bug.cgi?id=340
The solution is highly suboptimal and might bring performance degradation
// The proper solution is HARD because of :
// 1. idiotic xlib does not have XTryLockDisplay - we will need to _completely_ implement XLockDisplay by ourselves (including cascaded locking - it is not the same as mutex!)
// 2. the locking shemantic inside new lock_window and here will be really tricky, we should:
// in lock_window check wheather BC_WindowEvents is in XNextEvent and it is send custom xevent to break out of the loop and make sure lock is not taken again if locck_window is waiting for it
// 3. Send custom events from previous point through _separate_ xwindows display connection since XSendEvent would need to be protected by XLockDisplay which obviously can't be done inside the same thread!